Fixes groups

This commit is contained in:
Steve Ruiz 2021-06-04 17:14:01 +01:00
parent 506eecc95f
commit d9cbda45e6
3 changed files with 6 additions and 6 deletions

View file

@ -19,7 +19,7 @@ export default class CodeShape<T extends Shape> {
private utils: ShapeUtility<T> private utils: ShapeUtility<T>
constructor(props: T) { constructor(props: T) {
this._shape = createShape<T>(props.type, props) this._shape = createShape(props.type, props) as T
this.utils = getShapeUtils<T>(this._shape) this.utils = getShapeUtils<T>(this._shape)
codeShapes.add(this) codeShapes.add(this)
} }

View file

@ -6,7 +6,7 @@ import { current } from 'immer'
import { getBoundsFromPoints, getPage, updateParents } from 'utils/utils' import { getBoundsFromPoints, getPage, updateParents } from 'utils/utils'
import { getShapeUtils } from 'lib/shape-utils' import { getShapeUtils } from 'lib/shape-utils'
export default class PointsSession extends BaseSession { export default class ArrowSession extends BaseSession {
points: number[][] points: number[][]
origin: number[] origin: number[]
snapshot: ArrowSnapshot snapshot: ArrowSnapshot
@ -58,7 +58,7 @@ export default class PointsSession extends BaseSession {
}, },
}) })
updateParents(data, [shape]) updateParents(data, [shape.id])
} }
cancel(data: Data) { cancel(data: Data) {
@ -70,7 +70,7 @@ export default class PointsSession extends BaseSession {
.onHandleChange(shape, { end: initialShape.handles.end }) .onHandleChange(shape, { end: initialShape.handles.end })
.setProperty(shape, 'point', initialShape.point) .setProperty(shape, 'point', initialShape.point)
updateParents(data, [shape]) updateParents(data, [shape.id])
} }
complete(data: Data) { complete(data: Data) {

View file

@ -75,14 +75,14 @@ export default class BrushSession extends BaseSession {
const shape = getShape(data, snapshot.id) as DrawShape const shape = getShape(data, snapshot.id) as DrawShape
getShapeUtils(shape).setProperty(shape, 'points', [...this.points]) getShapeUtils(shape).setProperty(shape, 'points', [...this.points])
updateParents(data, [shape]) updateParents(data, [shape.id])
} }
cancel = (data: Data) => { cancel = (data: Data) => {
const { snapshot } = this const { snapshot } = this
const shape = getShape(data, snapshot.id) as DrawShape const shape = getShape(data, snapshot.id) as DrawShape
getShapeUtils(shape).setProperty(shape, 'points', snapshot.points) getShapeUtils(shape).setProperty(shape, 'points', snapshot.points)
updateParents(data, [shape]) updateParents(data, [shape.id])
} }
complete = (data: Data) => { complete = (data: Data) => {