Skip to content

Commit

Permalink
fix(dragging): remove hover class of hovered element on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
azeghers committed Nov 24, 2020
1 parent 3fa587c commit d9d90aa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/features/dragging/HoverFix.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var HIGH_PRIORITY = 1500;
* @param {Dragging} dragging
* @param {ElementRegistry} elementRegistry
*/
export default function HoverFix(eventBus, dragging, elementRegistry) {
export default function HoverFix(canvas, eventBus, dragging, elementRegistry) {

var self = this;

Expand Down Expand Up @@ -77,6 +77,16 @@ export default function HoverFix(eventBus, dragging, elementRegistry) {

});

/**
* We make sure that dropping an element forces the element
* we're hovering over to lose the hover class.
*/
eventBus.on('drag.end', function(event) {

canvas.removeMarker(event.hoverGfx, 'hover');

});


/**
* We make sure that drag.out is always fired, even if the
Expand Down Expand Up @@ -152,6 +162,7 @@ export default function HoverFix(eventBus, dragging, elementRegistry) {
}

HoverFix.$inject = [
'canvas',
'eventBus',
'dragging',
'elementRegistry'
Expand Down

0 comments on commit d9d90aa

Please sign in to comment.