Added event-triggers for dragged status

This commit is contained in:
Erik Tiekstra
2017-05-17 14:14:24 +02:00
parent 6ac64d18bd
commit ae9c75265d
4 changed files with 16 additions and 1 deletions
@@ -2,6 +2,7 @@
function ApertureHandler(canvas) {
var _items = {x: [], y: []};
var $document = $(document);
function init() {
var bounds = canvas;
@@ -61,6 +62,7 @@ function ApertureHandler(canvas) {
this.getApertures().forEach(function (o) {
o.opacity = apply ? 0.7 : 1;
});
canvas.renderAll();
return this;
};
+3 -1
View File
@@ -22,8 +22,10 @@ var Canvas = fabric.util.createClass(fabric.Canvas, {
this.on('mouse:up', function () {
if (this.getImage().__moved) {
this.getApertures().setTransparent(false);
// Trigger event to tell the image has been dragged.
$(document).trigger('PIE:dragged');
}
$(this.upperCanvasEl).css('cursor', 'default');
this.renderAll();
});
},
@@ -129,6 +129,10 @@ function Viewport(canvas) {
canvas.getApertures().setTransparent(true);
canvas.getImage().__moved = false;
canvas.getButtonMenu().bringToFront();
// Trigger event to tell the image needs to be dragged.
$(document).trigger('PIE:needs-dragging');
};
/**