Skip to content

Commit 122e3a4

Browse files
authored
Merge pull request #19 from dnohashi/moveComponent
Bug fix
2 parents 313396e + 231c02f commit 122e3a4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/components/ComponentDisplay.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,18 @@ export default {
6666
this.activeComponentData.y = y
6767
this.activeComponentData.w = width
6868
this.activeComponentData.h = height
69+
70+
this.componentMap[this.activeComponent].x = x
71+
this.componentMap[this.activeComponent].y = y
72+
this.componentMap[this.activeComponent].w = width
73+
this.componentMap[this.activeComponent].h = height
6974
},
7075
onDrag: function (x, y) {
7176
this.activeComponentData.x = x
7277
this.activeComponentData.y = y
78+
79+
this.componentMap[this.activeComponent].x = x
80+
this.componentMap[this.activeComponent].y = y
7381
},
7482
onActivated (componentData) {
7583
this.setActiveComponent(componentData.componentName)

src/store/actions.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ const actions = {
66
const { componentName } = payload
77
if (!state.componentMap[componentName]) {
88
commit(types.ADD_COMPONENT_TO_COMPONENT_MAP, payload)
9-
commit(
10-
types.ADD_COMPONENT_TO_ACTIVE_ROUTE_CHILDREN,
11-
payload.componentName
12-
)
9+
if (!state.parentSelected) {
10+
commit(
11+
types.ADD_COMPONENT_TO_ACTIVE_ROUTE_CHILDREN,
12+
payload.componentName
13+
)
14+
}
15+
1316
commit(types.ADD_COMPONENT_TO_ACTIVE_ROUTE_IN_ROUTE_MAP, payload)
1417

1518
let component = state.componentNameInputValue

0 commit comments

Comments
 (0)