Browse Source

Add `scrollCanvas` option in Layers

pull/1130/head
Artur Arseniev 8 years ago
parent
commit
96565dc2f1
  1. 5
      src/navigator/config/config.js
  2. 10
      src/navigator/view/ItemView.js

5
src/navigator/config/config.js

@ -18,5 +18,8 @@ module.exports = {
showWrapper: 1,
// Show hovered components in canvas
showHover: 1
showHover: 1,
// Scroll selected component in canvas
scrollCanvas: 1
};

10
src/navigator/view/ItemView.js

@ -196,7 +196,15 @@ module.exports = require('backbone').View.extend({
*/
handleSelect(e) {
e.stopPropagation();
this.em && this.em.setSelected(this.model, { fromLayers: 1 });
const { em, config } = this;
if (em) {
const model = this.model;
em.setSelected(model, { fromLayers: 1 });
if (config.scrollCanvas) {
em.get('Canvas').scrollTo(model, { behavior: 'smooth' });
}
}
},
/**

Loading…
Cancel
Save