Skip to content

Commit

Permalink
alex/state-node-prototype-2: remove old handles
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeHats committed Feb 28, 2024
1 parent 31b681e commit b92641a
Showing 1 changed file with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ import {
TLBaseShape,
TLDefaultColorStyle,
TLDefaultSizeStyle,
TLHandle,
TLOnBeforeUpdateHandler,
TLOnHandleDragHandler,
TLOnResizeHandler,
Vec,
VecModel,
ZERO_INDEX_KEY,
deepCopy,
getDefaultColorTheme,
resizeBox,
Expand Down Expand Up @@ -84,33 +81,33 @@ export class SpeechBubbleUtil extends ShapeUtil<SpeechBubbleShape> {
}

// [4]
override getHandles(shape: SpeechBubbleShape): TLHandle[] {
const { tail, w, h } = shape.props

return [
{
id: 'tail',
type: 'vertex',
index: ZERO_INDEX_KEY,
// props.tail coordinates are normalized
// but here we need them in shape space
x: tail.x * w,
y: tail.y * h,
},
]
}

override onHandleDrag: TLOnHandleDragHandler<SpeechBubbleShape> = (shape, { handle }) => {
return {
...shape,
props: {
tail: {
x: handle.x / shape.props.w,
y: handle.y / shape.props.h,
},
},
}
}
// override getHandles(shape: SpeechBubbleShape): TLHandle[] {
// const { tail, w, h } = shape.props

// return [
// {
// id: 'tail',
// type: 'vertex',
// index: ZERO_INDEX_KEY,
// // props.tail coordinates are normalized
// // but here we need them in shape space
// x: tail.x * w,
// y: tail.y * h,
// },
// ]
// }

// override onHandleDrag: TLOnHandleDragHandler<SpeechBubbleShape> = (shape, { handle }) => {
// return {
// ...shape,
// props: {
// tail: {
// x: handle.x / shape.props.w,
// y: handle.y / shape.props.h,
// },
// },
// }
// }

// [5]
override onBeforeUpdate: TLOnBeforeUpdateHandler<SpeechBubbleShape> | undefined = (
Expand Down

0 comments on commit b92641a

Please sign in to comment.