Disable move when locked

Disable shift move when locked
This commit is contained in:
Joren Dandois 2020-07-04 02:33:19 +02:00
parent a4d3d441db
commit aff1f7ccb6
2 changed files with 13 additions and 0 deletions

View File

@ -137,6 +137,11 @@
};
ns.DrawingController.prototype.onTouchstart_ = function (event) {
var index = this.piskelController.getCurrentLayerIndex();
var layer = this.piskelController.getLayerByIndex(index);
if (layer.locked) {
return;
}
this.onMousedown_(event);
};
@ -153,6 +158,11 @@
* @private
*/
ns.DrawingController.prototype.onMousedown_ = function (event) {
var index = this.piskelController.getCurrentLayerIndex();
var layer = this.piskelController.getLayerByIndex(index);
if (layer.locked) {
return;
}
$.publish(Events.MOUSE_EVENT, [event, this]);
var frame = this.piskelController.getCurrentFrame();
var coords = this.getSpriteCoordinates(event.clientX, event.clientY);

View File

@ -16,6 +16,9 @@ ns.ToolsHelper = {
var currentFrameIndex = pskl.app.piskelController.getCurrentFrameIndex();
var layers = useAllLayers ? pskl.app.piskelController.getLayers() : [pskl.app.piskelController.getCurrentLayer()];
return layers.reduce(function (previous, layer) {
if (layer.locked) {
return previous;
}
var frames = useAllFrames ? layer.getFrames() : [layer.getFrameAt(currentFrameIndex)];
return previous.concat(frames);
}, []);