Skip to content

Commit

Permalink
Fix hover state in Layers. Closes #3065
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Nov 18, 2020
1 parent 83cf200 commit e08b795
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/commands/view/SelectComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ export default {

if (el.ownerDocument === this.currentDoc) this.elHovered = result;
});
} else {
this.currentDoc = null;
this.elHovered = 0;
this.updateToolsLocal();
this.canvas.getFrames().forEach(frame => {
const { view } = frame;
const el = view && view.getToolsEl();
el && this.toggleToolsEl(0, 0, { el });
});
}
},

Expand Down Expand Up @@ -209,15 +218,7 @@ export default {
},

onOut() {
this.currentDoc = null;
this.em.setHovered(0);
this.elHovered = 0;
this.updateToolsLocal();
this.canvas.getFrames().forEach(frame => {
const { view } = frame;
const el = view && view.getToolsEl();
el && this.toggleToolsEl(0, 0, { el });
});
},

toggleToolsEl(on, view, opts = {}) {
Expand Down
7 changes: 7 additions & 0 deletions src/navigator/view/ItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default Backbone.View.extend({
'click [data-toggle-visible]': 'toggleVisibility',
'click [data-toggle-select]': 'handleSelect',
'mouseover [data-toggle-select]': 'handleHover',
'mouseout [data-toggle-select]': 'handleHoverOut',
'click [data-toggle-open]': 'toggleOpening',
'dblclick [data-name]': 'handleEdit',
'focusout [data-name]': 'handleEditEnd'
Expand Down Expand Up @@ -249,6 +250,12 @@ export default Backbone.View.extend({
em && config.showHover && em.setHovered(model, { fromLayers: 1 });
},

handleHoverOut(ev) {
ev.stopPropagation();
const { em, config } = this;
em && config.showHover && em.setHovered(0, { fromLayers: 1 });
},

/**
* Delegate to sorter
* @param Event
Expand Down

0 comments on commit e08b795

Please sign in to comment.