Skip to content

Commit 98807f3

Browse files
authored
ENG-754 migrate to BaseBoxShapeUtil (#715)
1 parent 3842231 commit 98807f3

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

apps/roam/src/components/canvas/DiscourseNodeUtil.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import {
2-
ShapeUtil,
3-
Rectangle2d,
2+
BaseBoxShapeUtil,
43
HTMLContainer,
54
TLBaseShape,
65
useEditor,
76
DefaultColorStyle,
87
Editor,
9-
TLOnResizeHandler,
10-
resizeBox,
118
createShapeId,
129
TLDefaultHorizontalAlignStyle,
1310
TLDefaultVerticalAlignStyle,
@@ -167,7 +164,7 @@ export type DiscourseNodeShape = TLBaseShape<
167164
fontFamily: TLDefaultFontStyle;
168165
}
169166
>;
170-
export class BaseDiscourseNodeUtil extends ShapeUtil<DiscourseNodeShape> {
167+
export class BaseDiscourseNodeUtil extends BaseBoxShapeUtil<DiscourseNodeShape> {
171168
type: string;
172169

173170
constructor(editor: Editor, type: string) {
@@ -190,14 +187,6 @@ export class BaseDiscourseNodeUtil extends ShapeUtil<DiscourseNodeShape> {
190187
override canResize = () => true;
191188
override canBind = () => true;
192189
override canEdit = () => true;
193-
getGeometry(shape: DiscourseNodeShape) {
194-
return new Rectangle2d({
195-
width: shape.props.w,
196-
height: shape.props.h,
197-
isFilled: true,
198-
});
199-
}
200-
201190
getDefaultProps(): DiscourseNodeShape["props"] {
202191
return {
203192
// opacity: "1" as DiscourseNodeShape["props"]["opacity"],
@@ -419,10 +408,6 @@ export class BaseDiscourseNodeUtil extends ShapeUtil<DiscourseNodeShape> {
419408
);
420409
}
421410

422-
override onResize: TLOnResizeHandler<DiscourseNodeShape> = (shape, info) => {
423-
return resizeBox(shape, info);
424-
};
425-
426411
indicator(shape: DiscourseNodeShape) {
427412
const { bounds } = this.editor.getShapeGeometry(shape);
428413
return (

0 commit comments

Comments
 (0)