Browse Source

Add `highlightHover` option in Layers

pull/1130/head
Artur Arseniev 8 years ago
parent
commit
91cb7b6b0e
  1. 9
      src/dom_components/view/ComponentView.js
  2. 5
      src/navigator/config/config.js
  3. 6
      src/navigator/view/ItemView.js

9
src/dom_components/view/ComponentView.js

@ -98,7 +98,7 @@ module.exports = Backbone.View.extend({
* @param {Event} e
* @private
* */
updateStatus(e) {
updateStatus(opts = {}) {
const em = this.em;
const el = this.el;
const status = this.model.get('status');
@ -127,15 +127,12 @@ module.exports = Backbone.View.extend({
cls = `${actualCls} ${freezedCls} ${selectedCls}`;
break;
case 'hovered':
cls = `${actualCls} ${hoveredCls}`;
cls = !opts.avoidHover ? `${actualCls} ${hoveredCls}` : '';
break;
}
cls = cls.trim();
if (cls) {
el.setAttribute('class', cls);
}
cls && el.setAttribute('class', cls);
},
/**

5
src/navigator/config/config.js

@ -26,5 +26,8 @@ module.exports = {
// Scroll to selected component in Layers when it's selected in Canvas
// true, false or `scrollIntoView`-like options
scrollLayers: 1
scrollLayers: 1,
// Highlight when a layer component is hovered
highlightHover: 1
};

6
src/navigator/view/ItemView.js

@ -250,7 +250,11 @@ module.exports = require('backbone').View.extend({
* @param Event
* */
updateStatus(e) {
ComponentView.prototype.updateStatus.apply(this, arguments);
ComponentView.prototype.updateStatus.apply(this, [
{
avoidHover: !this.config.highlightHover
}
]);
},
/**

Loading…
Cancel
Save