[fix] Only delete bindings if they were attached to a deleted group shape (#617)

* Only delete bindings if they were attached to a deleted group shape

* Update TransformSingleSession.ts
This commit is contained in:
Steve Ruiz 2022-03-10 19:39:21 +00:00 committed by GitHub
parent 1dd71f8b5e
commit 8039016416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -149,11 +149,13 @@ export function groupShapes(
const { bindings } = app
const deletedGroupIdsSet = new Set(deletedGroupIds)
// We also need to delete bindings that reference the deleted shapes
bindings.forEach((binding) => {
for (const id of [binding.toId, binding.fromId]) {
// If the binding references a deleted shape...
if (afterShapes[id] === undefined) {
if (deletedGroupIdsSet.has(id)) {
// Delete this binding
beforeBindings[binding.id] = binding
afterBindings[binding.id] = undefined

View file

@ -228,8 +228,6 @@ export class TransformSingleSession extends BaseSession {
if (initialShape.isLocked) return
console.log('completed', this.app.originPoint, this.app.currentPoint)
if (this.isCreate && Vec.dist(this.app.originPoint, this.app.currentPoint) < 2) {
return this.cancel()
}