fix(core): prevent overwriting size in node styles object (#1608)
* fix(core): prevent overwriting size in node styles object Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * fix(core): update node styles if `updateStyles` is `true` Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(core): update pkg json links Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(changeset): add Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --------- Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@vue-flow/core": patch
|
||||
---
|
||||
|
||||
Prevent overwriting width/height in node styles object with `node.width`/`node.height` if `width`/`height` already exist in the styles object.
|
||||
Fixes NodeResizer not working when initial size was passed to a node through `node.width`/`node.height`.
|
||||
@@ -6,9 +6,10 @@
|
||||
"author": "Burak Cakmakoglu<78412429+bcakmakoglu@users.noreply.github.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bcakmakoglu/vue-flow"
|
||||
"url": "git+https://github.com/bcakmakoglu/vue-flow",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"homepage": "https://github.com/bcakmakoglu/vue-flow#readme",
|
||||
"homepage": "https://vueflow.dev",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bcakmakoglu/vue-flow/issues"
|
||||
},
|
||||
|
||||
@@ -142,11 +142,11 @@ const NodeWrapper = defineComponent({
|
||||
const width = node.width instanceof Function ? node.width(node) : node.width
|
||||
const height = node.height instanceof Function ? node.height(node) : node.height
|
||||
|
||||
if (width) {
|
||||
if (!styles.width && width) {
|
||||
styles.width = typeof width === 'string' ? width : `${width}px`
|
||||
}
|
||||
|
||||
if (height) {
|
||||
if (!styles.height && height) {
|
||||
styles.height = typeof height === 'string' ? height : `${height}px`
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ export function applyChanges<
|
||||
element.dimensions = currentChange.dimensions
|
||||
}
|
||||
|
||||
if (typeof currentChange.updateStyle !== 'undefined') {
|
||||
if (typeof currentChange.updateStyle !== 'undefined' && currentChange.updateStyle) {
|
||||
element.style = {
|
||||
...(element.style || {}),
|
||||
width: `${currentChange.dimensions?.width}px`,
|
||||
|
||||
Reference in New Issue
Block a user