Skip to content

Commit

Permalink
fix: handle deselect template nodes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed Dec 2, 2018
1 parent 5b0d868 commit 8ee53ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
30 changes: 17 additions & 13 deletions src/view/components/PageMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,23 @@ export default Vue.extend({
...viewportMapper.mapActions(['resize', 'zoom']),
...guideMapper.mapActions(['selectTarget']),
onSelectNode({
ast,
element,
viewport
}: {
ast: TEElement
element: HTMLElement
viewport: HTMLElement
}): void {
this.select(ast)
this.selectTarget(element, viewport)
...guideMapper.mapActions(['selectTarget', 'deselect']),
onSelectNode(
data:
| {
ast: TEElement
element: HTMLElement
viewport: HTMLElement
}
| undefined
): void {
this.select(data ? data.ast : undefined)
if (data) {
this.selectTarget(data.element, data.viewport)
} else {
this.deselect()
}
}
}
})
Expand Down
8 changes: 7 additions & 1 deletion src/view/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ store.actions.guide.init(boundsCalculator)

store.subscribe(path => {
const mayRelayout = [
'project.setDocument',
'project.addElement',
'project.addChildComponent',
'project.setSharedStyle',
'project.refreshScope',
'project.cleanScope',
'project.updatePropValue',
'project.updateDataValue',
'viewport.resize',
'viewport.zoom'
]

const shouldReset = ['project.setDocuments', 'project.changeDocument']
const shouldReset = [
'project.setDocuments',
'project.removeDocument',
'project.changeActiveDocument'
]

const pathStr = path.join('.')
const guideActions = store.actions.guide
Expand Down

0 comments on commit 8ee53ea

Please sign in to comment.