[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:
Christian Petersen 2021-11-26 15:14:10 +00:00 committed by GitHub
parent 3de6ef334a
commit e2814943e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 4795 additions and 300 deletions

View file

@ -1,7 +1,7 @@
import { Tldraw, TldrawApp, useFileSystem } from '@tldraw/tldraw'
import * as gtag from '-utils/gtag'
import React from 'react'
import { useAccountHandlers } from '-hooks/useAccountHandlers'
import * as gtag from 'utils/gtag'
import { Tldraw, TldrawApp, useFileSystem } from '@tldraw/tldraw'
import { useAccountHandlers } from 'hooks/useAccountHandlers'
declare const window: Window & { app: TldrawApp }
@ -19,9 +19,9 @@ export default function Editor({ id = 'home', isUser = false, isSponsor = false
// Send events to gtag as actions.
const handlePersist = React.useCallback((_app: TldrawApp, reason?: string) => {
gtag.event({
action: reason,
action: reason ?? '',
category: 'editor',
label: reason || 'persist',
label: reason ?? 'persist',
value: 0,
})
}, [])