Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hover class of hovered element on drop #499

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the issue was:

Generally element.hover { A } -> element.out {A} -> element.hover {B} is fired
Firefox sometimes swallows the element.out {A} so we end up with a sequence of element.hover { A } -> element.hover {B} .

My intuition is that we should detect that broken sequence and emit the missing element.out {A}. If that is possible, it would be my preferred option.

Your solution drops the hover class, good. But it still leaves other components hanging that may rely on the proper sequence of hover -> out -> hover events.


});


/**
* 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