pull/3243/head
Mime Čuvalo 2024-03-22 21:10:20 +00:00
rodzic bf543332cc
commit fc91404346
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: BA84499022AC984D
7 zmienionych plików z 73 dodań i 74 usunięć

Wyświetl plik

@ -1599,7 +1599,6 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
canBind: <K>(_shape: Shape, _otherShape?: K | undefined) => boolean; canBind: <K>(_shape: Shape, _otherShape?: K | undefined) => boolean;
canCrop: TLShapeUtilFlag<Shape>; canCrop: TLShapeUtilFlag<Shape>;
canDropShapes(shape: Shape, shapes: TLShape[]): boolean; canDropShapes(shape: Shape, shapes: TLShape[]): boolean;
canDropShapesOnlyWithinMaskedBounds: TLShapeUtilFlag<Shape>;
canEdit: TLShapeUtilFlag<Shape>; canEdit: TLShapeUtilFlag<Shape>;
canEditInReadOnly: TLShapeUtilFlag<Shape>; canEditInReadOnly: TLShapeUtilFlag<Shape>;
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean; canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
@ -1624,6 +1623,7 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
hideSelectionBoundsFg: TLShapeUtilFlag<Shape>; hideSelectionBoundsFg: TLShapeUtilFlag<Shape>;
abstract indicator(shape: Shape): any; abstract indicator(shape: Shape): any;
isAspectRatioLocked: TLShapeUtilFlag<Shape>; isAspectRatioLocked: TLShapeUtilFlag<Shape>;
isFrame: TLShapeUtilFlag<Shape>;
isSticky: TLShapeUtilFlag<Shape>; isSticky: TLShapeUtilFlag<Shape>;
// (undocumented) // (undocumented)
static migrations?: Migrations; static migrations?: Migrations;

Wyświetl plik

@ -30401,41 +30401,6 @@
"isAbstract": false, "isAbstract": false,
"name": "canDropShapes" "name": "canDropShapes"
}, },
{
"kind": "Property",
"canonicalReference": "@tldraw/editor!ShapeUtil#canDropShapesOnlyWithinMaskedBounds:member",
"docComment": "/**\n * Whether the dropping a shape onto another behaves like a frame (true) where one has to drop the shape within the bounds of the frame, or like a stickies (false) where the shape is considered dropped when the bounding boxes collide.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "canDropShapesOnlyWithinMaskedBounds: "
},
{
"kind": "Reference",
"text": "TLShapeUtilFlag",
"canonicalReference": "@tldraw/editor!TLShapeUtilFlag:type"
},
{
"kind": "Content",
"text": "<Shape>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "canDropShapesOnlyWithinMaskedBounds",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{ {
"kind": "Property", "kind": "Property",
"canonicalReference": "@tldraw/editor!ShapeUtil#canEdit:member", "canonicalReference": "@tldraw/editor!ShapeUtil#canEdit:member",
@ -31284,6 +31249,41 @@
"isProtected": false, "isProtected": false,
"isAbstract": false "isAbstract": false
}, },
{
"kind": "Property",
"canonicalReference": "@tldraw/editor!ShapeUtil#isFrame:member",
"docComment": "/**\n * Whether the shape is a frame and carries the behaviors that go along with frames. Frames are shapes that can contain other shapes, in a portal-like fashion.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "isFrame: "
},
{
"kind": "Reference",
"text": "TLShapeUtilFlag",
"canonicalReference": "@tldraw/editor!TLShapeUtilFlag:type"
},
{
"kind": "Content",
"text": "<Shape>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "isFrame",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{ {
"kind": "Property", "kind": "Property",
"canonicalReference": "@tldraw/editor!ShapeUtil#isSticky:member", "canonicalReference": "@tldraw/editor!ShapeUtil#isSticky:member",

Wyświetl plik

@ -5026,7 +5026,7 @@ export class Editor extends EventEmitter<TLEventMap> {
// partially clipped by its own parent frame. // partially clipped by its own parent frame.
const maskedPageBounds = this.getShapeMaskedPageBounds(shape.id) const maskedPageBounds = this.getShapeMaskedPageBounds(shape.id)
if ( if (
this.getShapeUtil(shape).canDropShapesOnlyWithinMaskedBounds(shape) && this.getShapeUtil(shape).isFrame(shape) &&
maskedPageBounds && maskedPageBounds &&
maskedPageBounds.containsPoint(point) && maskedPageBounds.containsPoint(point) &&
this.getShapeGeometry(shape).hitTestPoint(this.getPointInShapeSpace(shape, point), 0, true) this.getShapeGeometry(shape).hitTestPoint(this.getPointInShapeSpace(shape, point), 0, true)

Wyświetl plik

@ -225,13 +225,12 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
} }
/** /**
* Whether the dropping a shape onto another behaves like a frame (true) where one * Whether the shape is a frame and carries the behaviors that go along with frames.
* has to drop the shape within the bounds of the frame, or like a stickies (false) where * Frames are shapes that can contain other shapes, in a portal-like fashion.
* the shape is considered dropped when the bounding boxes collide.
* *
* @public * @public
*/ */
canDropShapesOnlyWithinMaskedBounds: TLShapeUtilFlag<Shape> = () => true isFrame: TLShapeUtilFlag<Shape> = () => true
/** /**
* Whether the shape should adhere to other shapes: * Whether the shape should adhere to other shapes:

Wyświetl plik

@ -632,8 +632,6 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
// (undocumented) // (undocumented)
canDropShapes: (shape: TLFrameShape, _shapes: TLShape[]) => boolean; canDropShapes: (shape: TLFrameShape, _shapes: TLShape[]) => boolean;
// (undocumented) // (undocumented)
canDropShapesOnlyWithinMaskedBounds: () => boolean;
// (undocumented)
canEdit: () => boolean; canEdit: () => boolean;
// (undocumented) // (undocumented)
canReceiveNewChildrenOfType: (shape: TLShape, _type: TLShape['type']) => boolean; canReceiveNewChildrenOfType: (shape: TLShape, _type: TLShape['type']) => boolean;
@ -646,6 +644,8 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
// (undocumented) // (undocumented)
indicator(shape: TLFrameShape): JSX_2.Element; indicator(shape: TLFrameShape): JSX_2.Element;
// (undocumented) // (undocumented)
isFrame: () => boolean;
// (undocumented)
static migrations: Migrations; static migrations: Migrations;
// (undocumented) // (undocumented)
onDragShapesOut: (_shape: TLFrameShape, shapes: TLShape[]) => void; onDragShapesOut: (_shape: TLFrameShape, shapes: TLShape[]) => void;

Wyświetl plik

@ -7156,36 +7156,6 @@
"isProtected": false, "isProtected": false,
"isAbstract": false "isAbstract": false
}, },
{
"kind": "Property",
"canonicalReference": "tldraw!FrameShapeUtil#canDropShapesOnlyWithinMaskedBounds:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "canDropShapesOnlyWithinMaskedBounds: "
},
{
"kind": "Content",
"text": "() => boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "canDropShapesOnlyWithinMaskedBounds",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{ {
"kind": "Property", "kind": "Property",
"canonicalReference": "tldraw!FrameShapeUtil#canEdit:member", "canonicalReference": "tldraw!FrameShapeUtil#canEdit:member",
@ -7458,6 +7428,36 @@
"isAbstract": false, "isAbstract": false,
"name": "indicator" "name": "indicator"
}, },
{
"kind": "Property",
"canonicalReference": "tldraw!FrameShapeUtil#isFrame:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "isFrame: "
},
{
"kind": "Content",
"text": "() => boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "isFrame",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{ {
"kind": "Property", "kind": "Property",
"canonicalReference": "tldraw!FrameShapeUtil.migrations:member", "canonicalReference": "tldraw!FrameShapeUtil.migrations:member",

Wyświetl plik

@ -42,7 +42,7 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
override canEdit = () => true override canEdit = () => true
override canDropShapesOnlyWithinMaskedBounds = () => true override isFrame = () => true
override getDefaultProps(): TLFrameShape['props'] { override getDefaultProps(): TLFrameShape['props'] {
return { w: 160 * 2, h: 90 * 2, name: '' } return { w: 160 * 2, h: 90 * 2, name: '' }