Browse Source

Adjust toolbar positioning on component change

pull/1359/head
Artur Arseniev 8 years ago
parent
commit
227479b9c2
  1. 2
      dist/css/grapes.min.css
  2. 2
      docs/.vuepress/config.js
  3. 11
      src/commands/view/SelectComponent.js
  4. 2
      src/styles/scss/_gjs_canvas.scss

2
dist/css/grapes.min.css

File diff suppressed because one or more lines are too long

2
docs/.vuepress/config.js

@ -87,7 +87,7 @@ module.exports = {
['/modules/Components-js', 'Components & JS'], ['/modules/Components-js', 'Components & JS'],
['/modules/Traits', 'Trait Manager'], ['/modules/Traits', 'Trait Manager'],
['/modules/Style-manager', 'Style Manager'], ['/modules/Style-manager', 'Style Manager'],
['/modules/Storage', 'Storag Manager'], ['/modules/Storage', 'Storage Manager'],
['/modules/Plugins', 'Plugins'], ['/modules/Plugins', 'Plugins'],
] ]
}, { }, {

11
src/commands/view/SelectComponent.js

@ -70,7 +70,6 @@ module.exports = {
// Adjust tools scroll top // Adjust tools scroll top
if (!this.adjScroll) { if (!this.adjScroll) {
this.adjScroll = 1; this.adjScroll = 1;
this.onFrameScroll(e);
this.updateAttached(); this.updateAttached();
} }
@ -481,7 +480,9 @@ module.exports = {
this.toolbar.reset(toolbar); this.toolbar.reset(toolbar);
const view = model.view; const view = model.view;
view && this.updateToolbarPos(view.el); toolbarStyle.top = '100px';
toolbarStyle.left = 0;
setTimeout(() => view && this.updateToolbarPos(view.el), 0);
} else { } else {
toolbarStyle.display = 'none'; toolbarStyle.display = 'none';
} }
@ -496,8 +497,7 @@ module.exports = {
var unit = 'px'; var unit = 'px';
var toolbarEl = this.canvas.getToolbarEl(); var toolbarEl = this.canvas.getToolbarEl();
var toolbarStyle = toolbarEl.style; var toolbarStyle = toolbarEl.style;
const origDisp = toolbarStyle.display; toolbarStyle.opacity = 0;
toolbarStyle.display = 'block';
var pos = this.canvas.getTargetToElementDim(toolbarEl, el, { var pos = this.canvas.getTargetToElementDim(toolbarEl, el, {
elPos, elPos,
event: 'toolbarPosUpdate' event: 'toolbarPosUpdate'
@ -506,7 +506,7 @@ module.exports = {
var leftPos = pos.left + pos.elementWidth - pos.targetWidth; var leftPos = pos.left + pos.elementWidth - pos.targetWidth;
toolbarStyle.top = pos.top + unit; toolbarStyle.top = pos.top + unit;
toolbarStyle.left = (leftPos < 0 ? 0 : leftPos) + unit; toolbarStyle.left = (leftPos < 0 ? 0 : leftPos) + unit;
toolbarStyle.display = origDisp; toolbarStyle.opacity = '';
} }
}, },
@ -554,7 +554,6 @@ module.exports = {
/** /**
* Update attached elements, eg. component toolbar * Update attached elements, eg. component toolbar
* @return {[type]} [description]
*/ */
updateAttached(updated) { updateAttached(updated) {
const model = this.em.getSelected(); const model = this.em.getSelected();

2
src/styles/scss/_gjs_canvas.scss

@ -82,6 +82,8 @@ $canvasTop: 40px;
background-color: $colorBlue; background-color: $colorBlue;
color: white; color: white;
z-index: 10; z-index: 10;
top: 0;
left: 0;
} }
.#{$app-prefix}toolbar-item { .#{$app-prefix}toolbar-item {

Loading…
Cancel
Save