mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Bind node style directly
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div @click="makeActive()" :id="idString" :name="name" :node-label="label" :class="classes">
|
||||
<div @click="makeActive()" :id="idString" :name="name" :node-label="label" :class="classes" :style="style">
|
||||
<div class="node-header unselectable clearfix">
|
||||
<b-button
|
||||
v-b-tooltip.hover
|
||||
@@ -205,6 +205,29 @@ export default {
|
||||
}
|
||||
return cssObj;
|
||||
},
|
||||
style() {
|
||||
const step = this.step;
|
||||
const styleObj = {};
|
||||
if (step.position) {
|
||||
styleObj.top = step.position.top + "px";
|
||||
styleObj.left = step.position.left + "px";
|
||||
} else {
|
||||
// Set initial scroll position
|
||||
// TODO: should just be in template
|
||||
const p = document.getElementById("canvas-viewport");
|
||||
const o = document.getElementById("canvas-container");
|
||||
if (p && o) {
|
||||
const el = this.$el;
|
||||
const left =
|
||||
-o.offsetLeft + (p.offsetWidth - el.offsetWidth) / 2 + this.offsetVaryPosition(OFFSET_RANGE);
|
||||
const top =
|
||||
-o.offsetTop + (p.offsetHeight - el.offsetHeight) / 2 + this.offsetVaryPosition(OFFSET_RANGE);
|
||||
styleObj.top = `${top}px`;
|
||||
styleObj.left = `${left}px`;
|
||||
}
|
||||
}
|
||||
return styleObj;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.canvasManager = this.getCanvasManager();
|
||||
@@ -212,25 +235,6 @@ export default {
|
||||
this.element = this.$el;
|
||||
this.content_id = this.contentId;
|
||||
|
||||
// Set initial scroll position
|
||||
const step = this.step;
|
||||
const el = this.$el;
|
||||
if (step.position) {
|
||||
el.style.top = step.position.top + "px";
|
||||
el.style.left = step.position.left + "px";
|
||||
} else {
|
||||
const p = document.getElementById("canvas-viewport");
|
||||
const o = document.getElementById("canvas-container");
|
||||
if (p && o) {
|
||||
const left =
|
||||
-o.offsetLeft + (p.offsetWidth - el.offsetWidth) / 2 + this.offsetVaryPosition(OFFSET_RANGE);
|
||||
const top =
|
||||
-o.offsetTop + (p.offsetHeight - el.offsetHeight) / 2 + this.offsetVaryPosition(OFFSET_RANGE);
|
||||
el.style.top = `${top}px`;
|
||||
el.style.left = `${left}px`;
|
||||
}
|
||||
}
|
||||
|
||||
// Attach node dragging events
|
||||
attachDragging(this.$el, {
|
||||
dragstart: () => {
|
||||
|
||||
Reference in New Issue
Block a user