[feature] Add grids (#344)
* [feature] grids * Shows relative grids at different zoom levels * Update colors * Restores vec and intersect to monorepo, changes vec.round to vec.toFixed, adds vec.snap * Snapping in translate and transforms, fix shortcut * fix bugs in build * use grid size for nudge too * update scripts * Update grid.tsx * Update grid.tsx * Fixed! * Update grid.tsx * Fix package imports * Update Editor.tsx * Improve tsconfigs, imports * Fix tiny arrow bugs, snap starting points to grid * Update tsconfig.base.json * Update shape-styles.ts * Fix example tsconfig * Fix translate type error * Fix types, paths Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
3de6ef334a
commit
e2814943e9
105 changed files with 4795 additions and 300 deletions
|
@ -129,10 +129,17 @@ export function useMultiplayerState(roomId: string) {
|
|||
page: { shapes, bindings },
|
||||
},
|
||||
},
|
||||
} = doc.toObject()
|
||||
} = doc.toObject() as { document: TDDocument }
|
||||
|
||||
Object.values(shapes).forEach((shape) => lShapes.set(shape.id, shape))
|
||||
Object.values(bindings).forEach((binding) => lBindings.set(binding.id, binding))
|
||||
for (const key in shapes) {
|
||||
const shape = shapes[key]
|
||||
lShapes.set(shape.id, shape)
|
||||
}
|
||||
|
||||
for (const key in bindings) {
|
||||
const binding = bindings[key]
|
||||
lBindings.set(binding.id, binding)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,21 +182,23 @@ export function useMultiplayerState(roomId: string) {
|
|||
|
||||
if (!(lShapes && lBindings)) return
|
||||
|
||||
Object.entries(shapes).forEach(([id, shape]) => {
|
||||
for (const id in shapes) {
|
||||
const shape = shapes[id]
|
||||
if (!shape) {
|
||||
lShapes.delete(id)
|
||||
} else {
|
||||
lShapes.set(shape.id, shape)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Object.entries(bindings).forEach(([id, binding]) => {
|
||||
for (const id in bindings) {
|
||||
const binding = bindings[id]
|
||||
if (!binding) {
|
||||
lBindings.delete(id)
|
||||
} else {
|
||||
lBindings.set(binding.id, binding)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
rExpectingUpdate.current = true
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue