arrows: separate out handle behavior from labels (#2621)

This is a followup on the arrows work.
- allow labels to go to the ends if no arrowhead is present
- avoid using / overloading TLHandle and use a new PointingLabel state
to specifically address label movement
- removes the feature flag to launch this feature!

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Arrow labels: provide more polish on label placement

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Mime Čuvalo 2024-01-31 11:17:03 +00:00 committed by GitHub
parent f87702bda4
commit 34a95b2ec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 572 additions and 445 deletions

View file

@ -7,9 +7,9 @@ import { Atom, atom, react } from '@tldraw/state'
// development. Use `createFeatureFlag` to create a boolean flag which will be
// `true` by default in development and staging, and `false` in production.
/** @internal */
export const featureFlags = {
canMoveArrowLabel: createFeatureFlag('canMoveArrowLabel'),
} satisfies Record<string, DebugFlag<boolean>>
export const featureFlags: Record<string, DebugFlag<boolean>> = {
// canMoveArrowLabel: createFeatureFlag('canMoveArrowLabel'),
}
/** @internal */
export const debugFlags = {
@ -111,16 +111,16 @@ function createDebugValue<T>(
})
}
function createFeatureFlag(
name: string,
defaults: Defaults<boolean> = { all: true, production: false }
) {
return createDebugValueBase({
name,
defaults,
shouldStoreForSession: true,
})
}
// function createFeatureFlag(
// name: string,
// defaults: Defaults<boolean> = { all: true, production: false }
// ) {
// return createDebugValueBase({
// name,
// defaults,
// shouldStoreForSession: true,
// })
// }
function createDebugValueBase<T>(def: DebugFlagDef<T>): DebugFlag<T> {
const defaultValue = getDefaultValue(def)