mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix : Tools event listeners are now on window
Smoother user experience. Drawing shapes, selecting etc... is no longer blocked by either the drawing canvas or the document.
This commit is contained in:
@ -67,8 +67,6 @@
|
|||||||
ns.DrawingController.prototype.initMouseBehavior = function() {
|
ns.DrawingController.prototype.initMouseBehavior = function() {
|
||||||
var body = $('body');
|
var body = $('body');
|
||||||
this.container.mousedown($.proxy(this.onMousedown_, this));
|
this.container.mousedown($.proxy(this.onMousedown_, this));
|
||||||
this.container.mouseenter($.proxy(this.onMouseenter_, this));
|
|
||||||
this.container.mouseleave($.proxy(this.onMouseleave_, this));
|
|
||||||
|
|
||||||
if (pskl.utils.UserAgent.isChrome) {
|
if (pskl.utils.UserAgent.isChrome) {
|
||||||
this.container.on('mousewheel', $.proxy(this.onMousewheel_, this));
|
this.container.on('mousewheel', $.proxy(this.onMousewheel_, this));
|
||||||
@ -76,7 +74,8 @@
|
|||||||
this.container.on('wheel', $.proxy(this.onMousewheel_, this));
|
this.container.on('wheel', $.proxy(this.onMousewheel_, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mouseup($.proxy(this.onMouseup_, this));
|
window.addEventListener('mouseup', this.onMouseup_.bind(this));
|
||||||
|
window.addEventListener('mousemove', this.onMousemove_.bind(this));
|
||||||
|
|
||||||
// Deactivate right click:
|
// Deactivate right click:
|
||||||
body.contextmenu(this.onCanvasContextMenu_);
|
body.contextmenu(this.onCanvasContextMenu_);
|
||||||
@ -116,21 +115,6 @@
|
|||||||
$.publish(Events.ZOOM_CHANGED);
|
$.publish(Events.ZOOM_CHANGED);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ns.DrawingController.prototype.onMouseenter_ = function (event) {
|
|
||||||
$('body').bind('mousemove', $.proxy(this.onMousemove_, this));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ns.DrawingController.prototype.onMouseleave_ = function (event) {
|
|
||||||
this.container.unbind('mousemove');
|
|
||||||
this.currentToolBehavior.hideHighlightedPixel(this.overlayFrame);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
this.highlightedPixelCol = col;
|
this.highlightedPixelCol = col;
|
||||||
this.highlightedPixelRow = row;
|
this.highlightedPixelRow = row;
|
||||||
|
} else {
|
||||||
|
this.hideHighlightedPixel(overlay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,10 +70,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.BaseSelect.prototype.hideHighlightedPixel = function () {
|
|
||||||
// not implemented for selection tools
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we mouseover the selection draw inside the overlay frame, show the 'move' cursor
|
* If we mouseover the selection draw inside the overlay frame, show the 'move' cursor
|
||||||
* instead of the 'select' one. It indicates that we can move the selection by dragndroping it.
|
* instead of the 'select' one. It indicates that we can move the selection by dragndroping it.
|
||||||
|
Reference in New Issue
Block a user