diff --git a/src/components/interaction-designer/Block.vue b/src/components/interaction-designer/Block.vue
index 9dae63948..f72cb547f 100644
--- a/src/components/interaction-designer/Block.vue
+++ b/src/components/interaction-designer/Block.vue
@@ -11,6 +11,7 @@
:start-x="x"
:start-y="y"
:is-editable="isEditable"
+ @initialized="handleDraggableInitializedForBlock(block, $event)"
@dragged="onMoved"
@dragStarted="selectBlock"
@dragEnded="handleDraggableEndedForBlock"
@@ -131,11 +132,11 @@
'btn-info': exit.destination_block != null,
}"
:is-editable="isEditable"
- @initialized="handleDraggableInitializedFor(exit, $event)"
+ @initialized="handleDraggableInitializedForExit(exit, $event)"
@dragStarted="onCreateExitDragStarted($event, exit)"
@dragged="onCreateExitDragged($event)"
@dragEnded="onCreateExitDragEnded($event, exit)"
- @destroyed="handleDraggableDestroyedFor(exit)">
+ @destroyed="handleDraggableDestroyedForExit(exit)">
@@ -259,11 +260,17 @@ export default {
computed: {
...mapState('flow', [
'resources',
- 'selectedBlocks',
+ 'selectedBlockUuids',
]),
...mapState(
'builder',
- ['activeBlockId', 'operations', 'activeConnectionsContext', 'draggableForExitsByUuid'],
+ [
+ 'activeBlockId',
+ 'operations',
+ 'activeConnectionsContext',
+ 'draggableForExitsByUuid',
+ 'draggableForBlocksByUuid',
+ ],
),
...mapState({
blockClasses: ({trees: {ui}}) => ui.blockClasses,
@@ -285,7 +292,7 @@ export default {
},
isBlockSelected() {
- return includes(this.selectedBlocks, this.block.uuid)
+ return includes(this.selectedBlockUuids, this.block.uuid)
},
// todo: does this component know too much, what out of the above mapped state can be mapped?
@@ -318,6 +325,7 @@ export default {
}),
...mapActions('builder', [
+ 'changeBlockPositionTo',
// ConnectionSourceRelocate
'initializeConnectionSourceRelocateWith',
'setConnectionSourceRelocateValue',
@@ -455,16 +463,16 @@ export default {
this.setConnectionCreateTargetBlockToNullFrom({block})
},
- onMoved({position: {left: x, top: y}}) {
+ onMoved({position}) {
// todo: try this the vuejs way where we push the change into state, then return false + modify draggable w/in store ?
-
+ const {left: x, top: y} = position
const {block} = this
this.$nextTick(() => {
- this.setBlockPositionTo({position: {x, y}, block})
+ this.changeBlockPositionTo({position: {x, y}, block})
- forEach(this.draggableForExitsByUuid, (draggable, key) => {
+ forEach(this.draggableForExitsByUuid, (exitDraggable, key) => {
try {
- draggable.position()
+ exitDraggable.position()
} catch (e) {
console.warn('Block', 'onMoved', 'positioning draggable on', key, 'can\'t access property "initElm", props is undefined')
}
@@ -480,16 +488,24 @@ export default {
this.labelContainerMaxWidth += 0
},
- handleDraggableInitializedFor({uuid}, {draggable}) {
+ handleDraggableInitializedForBlock(block, {draggable}) {
+ this.draggableForBlocksByUuid[block.uuid] = draggable
+
+ const {left, top} = draggable
+
+ console.debug('Block', 'handleDraggableInitializedForBlock', {blockId: block.uuid, coords: {left, top}})
+ },
+
+ handleDraggableInitializedForExit({uuid}, {draggable}) {
this.draggableForExitsByUuid[uuid] = draggable
const {left, top} = draggable
const {uuid: blockId} = this.block
- console.debug('Block', 'handleDraggableInitializedFor', {blockId, exitId: uuid, coords: {left, top}})
+ console.debug('Block', 'handleDraggableInitializedForExit', {blockId, exitId: uuid, coords: {left, top}})
},
- handleDraggableDestroyedFor({uuid}) {
+ handleDraggableDestroyedForExit({uuid}) {
delete this.draggableForExitsByUuid[uuid]
},
diff --git a/src/components/interaction-designer/toolbar/ErrorNotifications.vue b/src/components/interaction-designer/toolbar/ErrorNotifications.vue
index a08667188..66faf1dcc 100644
--- a/src/components/interaction-designer/toolbar/ErrorNotifications.vue
+++ b/src/components/interaction-designer/toolbar/ErrorNotifications.vue
@@ -133,10 +133,6 @@ export default class ErrorNotifications extends mixins(Routes, Lang) {