kopia lustrzana https://github.com/Tldraw/Tldraw
rename
rodzic
bf543332cc
commit
fc91404346
|
@ -1599,7 +1599,6 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
|
|||
canBind: <K>(_shape: Shape, _otherShape?: K | undefined) => boolean;
|
||||
canCrop: TLShapeUtilFlag<Shape>;
|
||||
canDropShapes(shape: Shape, shapes: TLShape[]): boolean;
|
||||
canDropShapesOnlyWithinMaskedBounds: TLShapeUtilFlag<Shape>;
|
||||
canEdit: TLShapeUtilFlag<Shape>;
|
||||
canEditInReadOnly: TLShapeUtilFlag<Shape>;
|
||||
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
||||
|
@ -1624,6 +1623,7 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
|
|||
hideSelectionBoundsFg: TLShapeUtilFlag<Shape>;
|
||||
abstract indicator(shape: Shape): any;
|
||||
isAspectRatioLocked: TLShapeUtilFlag<Shape>;
|
||||
isFrame: TLShapeUtilFlag<Shape>;
|
||||
isSticky: TLShapeUtilFlag<Shape>;
|
||||
// (undocumented)
|
||||
static migrations?: Migrations;
|
||||
|
|
|
@ -30401,41 +30401,6 @@
|
|||
"isAbstract": false,
|
||||
"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",
|
||||
"canonicalReference": "@tldraw/editor!ShapeUtil#canEdit:member",
|
||||
|
@ -31284,6 +31249,41 @@
|
|||
"isProtected": 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",
|
||||
"canonicalReference": "@tldraw/editor!ShapeUtil#isSticky:member",
|
||||
|
|
|
@ -5026,7 +5026,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|||
// partially clipped by its own parent frame.
|
||||
const maskedPageBounds = this.getShapeMaskedPageBounds(shape.id)
|
||||
if (
|
||||
this.getShapeUtil(shape).canDropShapesOnlyWithinMaskedBounds(shape) &&
|
||||
this.getShapeUtil(shape).isFrame(shape) &&
|
||||
maskedPageBounds &&
|
||||
maskedPageBounds.containsPoint(point) &&
|
||||
this.getShapeGeometry(shape).hitTestPoint(this.getPointInShapeSpace(shape, point), 0, true)
|
||||
|
|
|
@ -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
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
canDropShapesOnlyWithinMaskedBounds: TLShapeUtilFlag<Shape> = () => true
|
||||
isFrame: TLShapeUtilFlag<Shape> = () => true
|
||||
|
||||
/**
|
||||
* Whether the shape should adhere to other shapes:
|
||||
|
|
|
@ -632,8 +632,6 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|||
// (undocumented)
|
||||
canDropShapes: (shape: TLFrameShape, _shapes: TLShape[]) => boolean;
|
||||
// (undocumented)
|
||||
canDropShapesOnlyWithinMaskedBounds: () => boolean;
|
||||
// (undocumented)
|
||||
canEdit: () => boolean;
|
||||
// (undocumented)
|
||||
canReceiveNewChildrenOfType: (shape: TLShape, _type: TLShape['type']) => boolean;
|
||||
|
@ -646,6 +644,8 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|||
// (undocumented)
|
||||
indicator(shape: TLFrameShape): JSX_2.Element;
|
||||
// (undocumented)
|
||||
isFrame: () => boolean;
|
||||
// (undocumented)
|
||||
static migrations: Migrations;
|
||||
// (undocumented)
|
||||
onDragShapesOut: (_shape: TLFrameShape, shapes: TLShape[]) => void;
|
||||
|
|
|
@ -7156,36 +7156,6 @@
|
|||
"isProtected": 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",
|
||||
"canonicalReference": "tldraw!FrameShapeUtil#canEdit:member",
|
||||
|
@ -7458,6 +7428,36 @@
|
|||
"isAbstract": false,
|
||||
"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",
|
||||
"canonicalReference": "tldraw!FrameShapeUtil.migrations:member",
|
||||
|
|
|
@ -42,7 +42,7 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|||
|
||||
override canEdit = () => true
|
||||
|
||||
override canDropShapesOnlyWithinMaskedBounds = () => true
|
||||
override isFrame = () => true
|
||||
|
||||
override getDefaultProps(): TLFrameShape['props'] {
|
||||
return { w: 160 * 2, h: 90 * 2, name: '' }
|
||||
|
|
Ładowanie…
Reference in New Issue