@yft-design/engine 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EngineCanvas.d.ts +6 -1
- package/dist/export/exportStencil.d.ts +3 -0
- package/dist/index.js +50 -50
- package/dist/interact/cropSession.d.ts +8 -1
- package/dist/model/compatObject.d.ts +2 -0
- package/dist/model/cropEdit.d.ts +2 -0
- package/dist/model/cropShape.d.ts +7 -0
- package/dist/render/SceneRenderer.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CropShapeSpec } from '../model/cropShape';
|
|
1
2
|
import { type Mat } from '../core/mat2d';
|
|
2
3
|
import type { EngineDocument } from '../model/document';
|
|
3
4
|
import { type SceneNode } from '../model/scene';
|
|
@@ -41,20 +42,25 @@ export interface CropSessionInfo {
|
|
|
41
42
|
width: number;
|
|
42
43
|
height: number;
|
|
43
44
|
isMask: boolean;
|
|
45
|
+
shapeActive: boolean;
|
|
44
46
|
}
|
|
45
47
|
export declare class CropSessionController {
|
|
46
48
|
private readonly host;
|
|
47
49
|
private node;
|
|
48
50
|
private circlesVisible;
|
|
49
51
|
private ratio;
|
|
52
|
+
private shape;
|
|
50
53
|
private detachKey;
|
|
51
54
|
constructor(host: CropSessionHost);
|
|
52
55
|
get active(): boolean;
|
|
53
56
|
get target(): SceneNode | null;
|
|
54
57
|
get info(): CropSessionInfo | null;
|
|
55
|
-
enter(node: SceneNode
|
|
58
|
+
enter(node: SceneNode, opts?: {
|
|
59
|
+
shape?: CropShapeSpec;
|
|
60
|
+
}): boolean;
|
|
56
61
|
exit(): void;
|
|
57
62
|
exitByOutsideClick(): void;
|
|
63
|
+
setCropShape(spec: CropShapeSpec | null): void;
|
|
58
64
|
setAspectRatio(ratio: number | null): void;
|
|
59
65
|
hitHandle(cssX: number, cssY: number): string | null;
|
|
60
66
|
hitRect(sceneX: number, sceneY: number): boolean;
|
|
@@ -62,6 +68,7 @@ export declare class CropSessionController {
|
|
|
62
68
|
x: number;
|
|
63
69
|
y: number;
|
|
64
70
|
}): void;
|
|
71
|
+
setScale(scale: number): boolean;
|
|
65
72
|
moveImageBy(delta: {
|
|
66
73
|
x: number;
|
|
67
74
|
y: number;
|
|
@@ -56,6 +56,8 @@ export interface CompatObjectContext {
|
|
|
56
56
|
bottom: number;
|
|
57
57
|
} | null;
|
|
58
58
|
setCropSessionAspectRatio?(ratio: number | null): void;
|
|
59
|
+
applyCropShape?(node: SceneNode, key: string | null): void;
|
|
60
|
+
updateCropSessionScale?(scale: number): boolean;
|
|
59
61
|
getTextGlyphPath?(node: SceneNode): {
|
|
60
62
|
path: string;
|
|
61
63
|
pathOffset: {
|
package/dist/model/cropEdit.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CornerHandle } from './handles';
|
|
|
2
2
|
import type { SerializedNode } from './scene';
|
|
3
3
|
export type CropCorner = CornerHandle;
|
|
4
4
|
export type CropEdge = 'left' | 'right' | 'top' | 'bottom';
|
|
5
|
+
export declare const MIN_CROP_WINDOW = 8;
|
|
5
6
|
export interface CropLiveState {
|
|
6
7
|
left: number;
|
|
7
8
|
top: number;
|
|
@@ -42,6 +43,7 @@ export declare const constrainToRatio: (rawWidth: number, rawHeight: number, rat
|
|
|
42
43
|
height: number;
|
|
43
44
|
};
|
|
44
45
|
export declare const applyCropRatioCorner: (s: CropLiveState, corner: CropCorner, pointer: Pt, ratio: number) => CropLiveState | null;
|
|
46
|
+
export declare const scaleCropWindow: (s: CropLiveState, scaleX: number, preserveScaleRatio?: boolean) => CropLiveState | null;
|
|
45
47
|
export declare const applyScaleEquallyCrop: (s: CropLiveState, corner: CropCorner, pointer: Pt) => CropLiveState | null;
|
|
46
48
|
export declare const moveCropImage: (s: CropLiveState, deltaScene: Pt) => {
|
|
47
49
|
cropX: number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CropLiveState } from './cropEdit';
|
|
2
|
+
export interface CropShapeSpec {
|
|
3
|
+
aspectRatio?: number;
|
|
4
|
+
pathOf: (width: number, height: number) => string;
|
|
5
|
+
}
|
|
6
|
+
export declare const cropShapeClipDecl: (shape: CropShapeSpec, width: number, height: number) => Record<string, unknown>;
|
|
7
|
+
export declare const squareCropWindow: (s: CropLiveState) => CropLiveState;
|
|
@@ -53,6 +53,7 @@ export declare class SceneRenderer {
|
|
|
53
53
|
private blender;
|
|
54
54
|
private blendWrapNode;
|
|
55
55
|
private clipContentNode;
|
|
56
|
+
private cropGhostPreDrawn;
|
|
56
57
|
private puzzleBox;
|
|
57
58
|
readonly stencilClip: StencilClipController;
|
|
58
59
|
private readonly maskGpu;
|
|
@@ -69,6 +70,9 @@ export declare class SceneRenderer {
|
|
|
69
70
|
private compositeFxBlended;
|
|
70
71
|
renderSceneNode(node: SceneNode): void;
|
|
71
72
|
private renderImageFamily;
|
|
73
|
+
private imageTextureOf;
|
|
74
|
+
private drawCropGhost;
|
|
75
|
+
private preDrawCropGhost;
|
|
72
76
|
private renderMaskNode;
|
|
73
77
|
private renderAnimatedNode;
|
|
74
78
|
private renderImagePlaceholder;
|