Moves selectedIds into page state, state mounts only one page state / page at a time

This commit is contained in:
Steve Ruiz 2021-06-07 12:18:50 +01:00
parent 45fd645885
commit 350c1debde
34 changed files with 445 additions and 249 deletions

View file

@ -1,7 +1,7 @@
import Command from './command'
import history from '../history'
import { Data } from 'types'
import { getPage } from 'utils/utils'
import { getPage, getSelectedIds } from 'utils/utils'
import { ArrowSnapshot } from 'state/sessions/arrow-session'
export default function arrowCommand(
@ -24,8 +24,9 @@ export default function arrowCommand(
page.shapes[initialShape.id] = initialShape
data.selectedIds.clear()
data.selectedIds.add(initialShape.id)
const selectedIds = getSelectedIds(data)
selectedIds.clear()
selectedIds.add(initialShape.id)
data.hoveredId = undefined
data.pointedId = undefined
},
@ -35,7 +36,8 @@ export default function arrowCommand(
delete shapes[initialShape.id]
data.selectedIds.clear()
const selectedIds = getSelectedIds(data)
selectedIds.clear()
data.hoveredId = undefined
data.pointedId = undefined
},