@yft-design/engine 0.0.17 → 0.0.19
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/README.md +23 -11
- package/dist/EngineCanvas.d.ts +0 -255
- package/dist/core/color.d.ts +0 -11
- package/dist/core/distanceField.d.ts +0 -13
- package/dist/core/events.d.ts +0 -25
- package/dist/core/gradient.d.ts +0 -47
- package/dist/core/homography.d.ts +0 -20
- package/dist/core/imageFilters.d.ts +0 -31
- package/dist/core/mat2d.d.ts +0 -62
- package/dist/core/pathData.d.ts +0 -36
- package/dist/core/pattern.d.ts +0 -14
- package/dist/core/point.d.ts +0 -14
- package/dist/core/psdEffects.d.ts +0 -48
- package/dist/core/roundedRect.d.ts +0 -48
- package/dist/core/shadow.d.ts +0 -23
- package/dist/core/snap.d.ts +0 -103
- package/dist/core/stroke.d.ts +0 -13
- package/dist/core/triangulate.d.ts +0 -31
- package/dist/core/warpMesh.d.ts +0 -38
- package/dist/debug/canvasInspection.d.ts +0 -20
- package/dist/debug/pixelDiff.d.ts +0 -7
- package/dist/debug/pixelDiff.js +1 -64
- package/dist/debug/seed.d.ts +0 -426
- package/dist/debug/seed.js +28 -3806
- package/dist/decoders/webp2sprite.d.ts +0 -16
- package/dist/engineFlag.d.ts +0 -76
- package/dist/export/SceneExporter.d.ts +0 -58
- package/dist/export/glExport.d.ts +0 -41
- package/dist/export/svgExport.d.ts +0 -181
- package/dist/index.d.ts +1 -14
- package/dist/index.js +1060 -64
- package/dist/interact/animationPlayback.d.ts +0 -62
- package/dist/interact/canvasInteractions.d.ts +1 -38
- package/dist/interact/cropSession.d.ts +0 -68
- package/dist/interact/dblClick.d.ts +0 -32
- package/dist/interact/expandSession.d.ts +0 -46
- package/dist/interact/hotkeyActions.d.ts +0 -12
- package/dist/interact/pageTransfer.d.ts +0 -2
- package/dist/interact/pathSession.d.ts +0 -42
- package/dist/interact/pointer.d.ts +0 -87
- package/dist/interact/pointerTablePuzzle.d.ts +0 -60
- package/dist/interact/pointerTransform.d.ts +0 -48
- package/dist/interact/pointerTypes.d.ts +6 -148
- package/dist/interact/snapGuide.d.ts +0 -68
- package/dist/interact/tableCellEditing.d.ts +0 -34
- package/dist/interact/tableInteraction.d.ts +0 -31
- package/dist/interact/textEditing.d.ts +0 -44
- package/dist/interact/warpFacade.d.ts +0 -5
- package/dist/interact/warpSession.d.ts +0 -55
- package/dist/interact/wheelScroll.d.ts +0 -42
- package/dist/model/alphaHit.d.ts +0 -51
- package/dist/model/animation.d.ts +0 -99
- package/dist/model/arcLayout.d.ts +0 -33
- package/dist/model/arcTextTransform.d.ts +0 -4
- package/dist/model/compatEvents.d.ts +0 -72
- package/dist/model/compatObject.d.ts +0 -360
- package/dist/model/cropEdit.d.ts +0 -60
- package/dist/model/document.d.ts +0 -167
- package/dist/model/elementTypes.d.ts +0 -47
- package/dist/model/expandEdit.d.ts +0 -36
- package/dist/model/fabricPrimitives.d.ts +0 -24
- package/dist/model/filler.d.ts +0 -12
- package/dist/model/groupAssemble.d.ts +0 -5
- package/dist/model/groupChildMove.d.ts +0 -37
- package/dist/model/groupResize.d.ts +0 -42
- package/dist/model/handles.d.ts +0 -24
- package/dist/model/imageMaskBake.d.ts +0 -50
- package/dist/model/lineConstruct.d.ts +0 -8
- package/dist/model/maskCropEdit.d.ts +0 -34
- package/dist/model/pathBackground.d.ts +0 -33
- package/dist/model/pathConstruct.d.ts +0 -24
- package/dist/model/pathEdit.d.ts +0 -55
- package/dist/model/puzzleEdit.d.ts +0 -66
- package/dist/model/puzzleLayout.d.ts +0 -31
- package/dist/model/scene.d.ts +0 -603
- package/dist/model/schema.d.ts +0 -48
- package/dist/model/shapePath.d.ts +0 -5
- package/dist/model/smartObjectBake.d.ts +0 -6
- package/dist/model/tableEdit.d.ts +0 -90
- package/dist/model/tableFacade.d.ts +0 -5
- package/dist/model/tableLayout.d.ts +0 -40
- package/dist/model/textAlign.d.ts +0 -22
- package/dist/model/textLayout.d.ts +0 -213
- package/dist/render/GLBlend.d.ts +0 -24
- package/dist/render/GLContext.d.ts +0 -11
- package/dist/render/GLIsolate.d.ts +0 -25
- package/dist/render/GLTextureCache.d.ts +0 -72
- package/dist/render/GlyphAtlas.d.ts +0 -98
- package/dist/render/MeshBatch.d.ts +0 -71
- package/dist/render/QuadBatch.d.ts +0 -87
- package/dist/render/SceneRenderer.d.ts +0 -137
- package/dist/render/SourceManager.d.ts +0 -82
- package/dist/render/TextRenderer.d.ts +0 -120
- package/dist/render/arcText.d.ts +0 -28
- package/dist/render/bakeGate.d.ts +0 -35
- package/dist/render/batchOrder.d.ts +0 -60
- package/dist/render/blendMode.d.ts +0 -27
- package/dist/render/clipMaskPainter.d.ts +0 -42
- package/dist/render/fontInvalidation.d.ts +0 -18
- package/dist/render/fontInvalidationController.d.ts +0 -52
- package/dist/render/frameOverlay.d.ts +0 -32
- package/dist/render/framePipeline.d.ts +0 -27
- package/dist/render/gpuFilterPasses.d.ts +0 -15
- package/dist/render/gpuFx.d.ts +0 -82
- package/dist/render/gpuImageFilters.d.ts +0 -41
- package/dist/render/gpuShadow.d.ts +0 -38
- package/dist/render/gradientRamp.d.ts +0 -14
- package/dist/render/imageEffects.d.ts +0 -99
- package/dist/render/lineDecorationSdf.d.ts +0 -32
- package/dist/render/maskRender.d.ts +0 -60
- package/dist/render/multiPage.d.ts +0 -91
- package/dist/render/progressiveLoad.d.ts +0 -27
- package/dist/render/psdEffectPainter.d.ts +0 -25
- package/dist/render/psdWarpText.d.ts +0 -19
- package/dist/render/puzzleClamp.d.ts +0 -15
- package/dist/render/renderEpoch.d.ts +0 -21
- package/dist/render/retainedFrame.d.ts +0 -36
- package/dist/render/ruler.d.ts +0 -36
- package/dist/render/screenClip.d.ts +0 -31
- package/dist/render/scrollText.d.ts +0 -46
- package/dist/render/segmentTable.d.ts +0 -30
- package/dist/render/selectionOverlay.d.ts +0 -203
- package/dist/render/settleScheduler.d.ts +0 -24
- package/dist/render/shaders.d.ts +4 -24
- package/dist/render/shadowBake.d.ts +0 -28
- package/dist/render/shadowPainter.d.ts +0 -8
- package/dist/render/sharedGpuPainters.d.ts +0 -13
- package/dist/render/sourceHydration.d.ts +0 -8
- package/dist/render/strokeBake.d.ts +0 -59
- package/dist/render/strokeMiterOutline.d.ts +0 -29
- package/dist/render/strokePainter.d.ts +0 -31
- package/dist/render/strokeSdf.d.ts +0 -52
- package/dist/render/svgRaster.d.ts +0 -34
- package/dist/render/tableOverlay.d.ts +0 -35
- package/dist/render/textHighlight.d.ts +0 -67
- package/dist/render/textureUpload.d.ts +0 -13
- package/dist/render/verticalText.d.ts +0 -21
- package/dist/render/warpText.d.ts +0 -48
- package/dist/render/workspaceBackdrop.d.ts +0 -22
- package/dist/render/workspaceChecker.d.ts +0 -34
- package/dist/render/workspaceGlow.d.ts +0 -38
- package/package.json +4 -3
- package/dist/EngineCanvas.js +0 -1202
- package/dist/core/canvasPerf.js +0 -170
- package/dist/core/color.js +0 -107
- package/dist/core/distanceField.js +0 -92
- package/dist/core/events.js +0 -80
- package/dist/core/gradient.js +0 -175
- package/dist/core/homography.js +0 -123
- package/dist/core/imageFilters.js +0 -330
- package/dist/core/mat2d.js +0 -241
- package/dist/core/pathData.js +0 -926
- package/dist/core/pattern.js +0 -40
- package/dist/core/point.js +0 -119
- package/dist/core/psdEffects.js +0 -158
- package/dist/core/roundedRect.js +0 -164
- package/dist/core/shadow.js +0 -47
- package/dist/core/snap.js +0 -793
- package/dist/core/stroke.js +0 -45
- package/dist/core/triangulate.js +0 -194
- package/dist/core/warpMesh.js +0 -469
- package/dist/debug/canvasInspection.js +0 -113
- package/dist/decoders/gif2sprite.js +0 -84
- package/dist/decoders/webp2sprite.js +0 -133
- package/dist/engineFlag.js +0 -104
- package/dist/export/SceneExporter.js +0 -286
- package/dist/export/glExport.js +0 -79
- package/dist/export/svgExport.js +0 -1803
- package/dist/interact/animationPlayback.js +0 -358
- package/dist/interact/canvasInteractions.js +0 -174
- package/dist/interact/cropSession.js +0 -527
- package/dist/interact/dblClick.js +0 -120
- package/dist/interact/expandSession.js +0 -282
- package/dist/interact/hotkeyActions.js +0 -42
- package/dist/interact/pageTransfer.js +0 -56
- package/dist/interact/pathSession.js +0 -480
- package/dist/interact/pointer.js +0 -1692
- package/dist/interact/pointerTablePuzzle.js +0 -358
- package/dist/interact/pointerTransform.js +0 -441
- package/dist/interact/pointerTypes.js +0 -96
- package/dist/interact/snapGuide.js +0 -377
- package/dist/interact/tableCellEditing.js +0 -207
- package/dist/interact/tableInteraction.js +0 -219
- package/dist/interact/textEditing.js +0 -423
- package/dist/interact/warpFacade.js +0 -51
- package/dist/interact/warpSession.js +0 -583
- package/dist/interact/wheelScroll.js +0 -100
- package/dist/model/alphaHit.js +0 -267
- package/dist/model/animation.js +0 -510
- package/dist/model/arcLayout.js +0 -308
- package/dist/model/arcTextTransform.js +0 -87
- package/dist/model/compatEvents.js +0 -96
- package/dist/model/compatObject.js +0 -1583
- package/dist/model/cropEdit.js +0 -497
- package/dist/model/document.js +0 -590
- package/dist/model/elementTypes.js +0 -119
- package/dist/model/expandEdit.js +0 -161
- package/dist/model/fabricPrimitives.js +0 -9
- package/dist/model/filler.js +0 -1
- package/dist/model/groupAssemble.js +0 -98
- package/dist/model/groupChildMove.js +0 -145
- package/dist/model/groupResize.js +0 -109
- package/dist/model/handles.js +0 -29
- package/dist/model/imageMaskBake.js +0 -136
- package/dist/model/lineConstruct.js +0 -79
- package/dist/model/maskCropEdit.js +0 -90
- package/dist/model/pathBackground.js +0 -196
- package/dist/model/pathConstruct.js +0 -55
- package/dist/model/pathEdit.js +0 -378
- package/dist/model/puzzleEdit.js +0 -742
- package/dist/model/puzzleLayout.js +0 -143
- package/dist/model/scene.js +0 -2930
- package/dist/model/schema.js +0 -13
- package/dist/model/shapePath.js +0 -137
- package/dist/model/smartObjectBake.js +0 -295
- package/dist/model/tableEdit.js +0 -751
- package/dist/model/tableFacade.js +0 -808
- package/dist/model/tableLayout.js +0 -194
- package/dist/model/textAlign.js +0 -36
- package/dist/model/textLayout.js +0 -842
- package/dist/render/GLBlend.js +0 -270
- package/dist/render/GLContext.js +0 -48
- package/dist/render/GLIsolate.js +0 -188
- package/dist/render/GLTextureCache.js +0 -224
- package/dist/render/GlyphAtlas.js +0 -412
- package/dist/render/MeshBatch.js +0 -416
- package/dist/render/QuadBatch.js +0 -561
- package/dist/render/SceneRenderer.js +0 -753
- package/dist/render/SourceManager.js +0 -523
- package/dist/render/TextRenderer.js +0 -854
- package/dist/render/arcText.js +0 -187
- package/dist/render/bakeGate.js +0 -32
- package/dist/render/batchOrder.js +0 -168
- package/dist/render/blendMode.js +0 -142
- package/dist/render/clipMaskPainter.js +0 -244
- package/dist/render/fontInvalidation.js +0 -77
- package/dist/render/fontInvalidationController.js +0 -119
- package/dist/render/frameOverlay.js +0 -124
- package/dist/render/framePipeline.js +0 -96
- package/dist/render/gpuFilterPasses.js +0 -883
- package/dist/render/gpuFx.js +0 -673
- package/dist/render/gpuImageFilters.js +0 -295
- package/dist/render/gpuShadow.js +0 -327
- package/dist/render/gradientRamp.js +0 -74
- package/dist/render/imageEffects.js +0 -415
- package/dist/render/lineDecorationSdf.js +0 -189
- package/dist/render/maskRender.js +0 -217
- package/dist/render/multiPage.js +0 -420
- package/dist/render/progressiveLoad.js +0 -86
- package/dist/render/psdEffectPainter.js +0 -333
- package/dist/render/psdWarpText.js +0 -212
- package/dist/render/puzzleClamp.js +0 -30
- package/dist/render/renderEpoch.js +0 -35
- package/dist/render/renderViewport.js +0 -18
- package/dist/render/retainedFrame.js +0 -192
- package/dist/render/ruler.js +0 -287
- package/dist/render/screenClip.js +0 -67
- package/dist/render/scrollText.js +0 -266
- package/dist/render/segmentTable.js +0 -117
- package/dist/render/selectionOverlay.js +0 -1008
- package/dist/render/settleScheduler.js +0 -51
- package/dist/render/shaders.js +0 -450
- package/dist/render/shadowBake.js +0 -203
- package/dist/render/shadowPainter.js +0 -93
- package/dist/render/sharedGpuPainters.js +0 -42
- package/dist/render/sourceHydration.js +0 -48
- package/dist/render/strokeBake.js +0 -516
- package/dist/render/strokeMiterOutline.js +0 -224
- package/dist/render/strokePainter.js +0 -207
- package/dist/render/strokeSdf.js +0 -262
- package/dist/render/svgRaster.js +0 -71
- package/dist/render/tableOverlay.js +0 -233
- package/dist/render/textHighlight.js +0 -380
- package/dist/render/textureUpload.js +0 -26
- package/dist/render/verticalText.js +0 -63
- package/dist/render/warpText.js +0 -384
- package/dist/render/workspaceBackdrop.js +0 -60
- package/dist/render/workspaceChecker.js +0 -170
- package/dist/render/workspaceGlow.js +0 -198
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 拼图布局纯函数(P4-5b(2/2)):应用 FabricPuzzle 的布局数学逐式移植。
|
|
3
|
-
*
|
|
4
|
-
* 两处消费:
|
|
5
|
-
* - `computePuzzleItems`:create/updateLayout 共用的「pieces → 每块 {w,h,cx,cy}」
|
|
6
|
-
* 公式(组中心相对空间)——引擎 PuzzleNode 构造期结构不完整时的重排兜底
|
|
7
|
-
* (structureIntact 时信任序列化几何,应用 fromObject 同契约)
|
|
8
|
-
* - `applyPuzzleContainerResize`:边中点手柄拖拽的 resizeByContainer 语义——
|
|
9
|
-
* 按比例缩放布局参数(layoutWidth/Height、hGap/vGap、groupPadding)与逐块
|
|
10
|
-
* 几何(中心坐标 + 宽高),clipImage 走「cover 比例 × 用户缩放因子」防累乘
|
|
11
|
-
*
|
|
12
|
-
* 本模块只算不写:入参出参都是普通对象,节点/序列化的落盘由调用方
|
|
13
|
-
* (PuzzleNode / interact/pointer)执行。
|
|
14
|
-
*/
|
|
15
|
-
/** layoutConfig 声明解析(坏声明返回 null——应用 updateLayout 同守卫) */
|
|
16
|
-
export const parsePuzzleLayout = (raw) => {
|
|
17
|
-
if (!raw || typeof raw !== 'object')
|
|
18
|
-
return null;
|
|
19
|
-
const o = raw;
|
|
20
|
-
if (typeof o.rows !== 'number' || typeof o.cols !== 'number' || !Array.isArray(o.pieces) || o.pieces.length === 0)
|
|
21
|
-
return null;
|
|
22
|
-
const pieces = [];
|
|
23
|
-
for (const p of o.pieces) {
|
|
24
|
-
if (!p || typeof p !== 'object')
|
|
25
|
-
continue;
|
|
26
|
-
const d = p;
|
|
27
|
-
if (typeof d.row !== 'number' || typeof d.col !== 'number')
|
|
28
|
-
continue;
|
|
29
|
-
pieces.push({
|
|
30
|
-
id: p.id,
|
|
31
|
-
row: d.row,
|
|
32
|
-
col: d.col,
|
|
33
|
-
rowSpan: p.rowSpan,
|
|
34
|
-
colSpan: p.colSpan
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return pieces.length > 0 ? { rows: o.rows, cols: o.cols, pieces } : null;
|
|
38
|
-
};
|
|
39
|
-
/** 逐块摆位与尺寸(应用 FabricPuzzle.create / updateLayout 同一公式,组中心相对空间) */
|
|
40
|
-
export const computePuzzleItems = (layout, params) => {
|
|
41
|
-
const { rows, cols, pieces } = layout;
|
|
42
|
-
const innerW = Math.max(0, params.width - params.groupPadding * 2);
|
|
43
|
-
const innerH = Math.max(0, params.height - params.groupPadding * 2);
|
|
44
|
-
const totalHGap = params.hGap * Math.max(0, cols - 1);
|
|
45
|
-
const totalVGap = params.vGap * Math.max(0, rows - 1);
|
|
46
|
-
const cellW = cols > 0 ? (innerW - totalHGap) / cols : 0;
|
|
47
|
-
const cellH = rows > 0 ? (innerH - totalVGap) / rows : 0;
|
|
48
|
-
const stepX = cellW + params.hGap;
|
|
49
|
-
const stepY = cellH + params.vGap;
|
|
50
|
-
const centerColBase = (cols - 1) / 2;
|
|
51
|
-
const centerRowBase = (rows - 1) / 2;
|
|
52
|
-
return pieces.map((piece) => {
|
|
53
|
-
const colSpan = piece.colSpan ?? 1;
|
|
54
|
-
const rowSpan = piece.rowSpan ?? 1;
|
|
55
|
-
const w = Math.max(cellW * colSpan + params.hGap * (colSpan - 1), 0);
|
|
56
|
-
const h = Math.max(cellH * rowSpan + params.vGap * (rowSpan - 1), 0);
|
|
57
|
-
const centerCol = piece.col + (colSpan - 1) / 2;
|
|
58
|
-
const centerRow = piece.row + (rowSpan - 1) / 2;
|
|
59
|
-
return { w, h, cx: (centerCol - centerColBase) * stepX, cy: (centerRow - centerRowBase) * stepY };
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
/** clipImage 的「原图尺寸」——应用 getOriginalElementWidth 链的确定性等价:
|
|
63
|
-
* 运行中取元素 natural 尺寸,元素未挂载时回落序列化 width(FabricImage 序列化
|
|
64
|
-
* width = 未缩放基宽,fromURL 产物与 natural 相等——手势期与单位测试同口径) */
|
|
65
|
-
export const clipOriginalSize = (clip, el) => {
|
|
66
|
-
if (el && el.naturalWidth && el.naturalHeight)
|
|
67
|
-
return { w: el.naturalWidth, h: el.naturalHeight };
|
|
68
|
-
return { w: clip?.width ?? 0, h: clip?.height ?? 0 };
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* 按容器比例缩放拼图(应用 resizeByContainer 逐行同源):
|
|
72
|
-
* - 布局参数:layoutWidth/Height ×ratio;同轴 hGap/vGap 与双轴 groupPadding ×ratio
|
|
73
|
-
* - 逐块:中心坐标同轴 ×ratio、宽高 ×ratio(≥1 钳制)
|
|
74
|
-
* - clipImage:cover 比例换算——userFactor = 旧 scale / 旧 cover 保持用户缩放,
|
|
75
|
-
* nextScale = 新 cover × userFactor;clipX/clipY 按块宽高比例缩放
|
|
76
|
-
* 非有限/非正比例按 1 处理;两轴都无变化返回 false(应用早退语义)。
|
|
77
|
-
*/
|
|
78
|
-
export const applyPuzzleContainerResize = (state, ratios, clipSizes) => {
|
|
79
|
-
const sx = typeof ratios.widthRatio === 'number' && isFinite(ratios.widthRatio) && ratios.widthRatio > 0 ? ratios.widthRatio : 1;
|
|
80
|
-
const sy = typeof ratios.heightRatio === 'number' && isFinite(ratios.heightRatio) && ratios.heightRatio > 0 ? ratios.heightRatio : 1;
|
|
81
|
-
const widthChanged = sx !== 1;
|
|
82
|
-
const heightChanged = sy !== 1;
|
|
83
|
-
if (!widthChanged && !heightChanged)
|
|
84
|
-
return false;
|
|
85
|
-
if (state.masks.length === 0)
|
|
86
|
-
return false;
|
|
87
|
-
const prevLayoutWidth = state.width || 0;
|
|
88
|
-
const prevLayoutHeight = state.height || 0;
|
|
89
|
-
if (widthChanged && prevLayoutWidth) {
|
|
90
|
-
state.width = prevLayoutWidth * sx;
|
|
91
|
-
state.hGap *= sx;
|
|
92
|
-
state.groupPadding *= sx;
|
|
93
|
-
}
|
|
94
|
-
if (heightChanged && prevLayoutHeight) {
|
|
95
|
-
state.height = prevLayoutHeight * sy;
|
|
96
|
-
state.vGap *= sy;
|
|
97
|
-
state.groupPadding *= sy;
|
|
98
|
-
}
|
|
99
|
-
state.masks.forEach((mask, idx) => {
|
|
100
|
-
const prevW = mask.width || 0;
|
|
101
|
-
const prevH = mask.height || 0;
|
|
102
|
-
const newW = widthChanged ? Math.max(prevW * sx, 1) : prevW;
|
|
103
|
-
const newH = heightChanged ? Math.max(prevH * sy, 1) : prevH;
|
|
104
|
-
const newLeft = widthChanged ? (mask.left || 0) * sx : mask.left;
|
|
105
|
-
const newTop = heightChanged ? (mask.top || 0) * sy : mask.top;
|
|
106
|
-
mask.left = newLeft;
|
|
107
|
-
mask.top = newTop;
|
|
108
|
-
mask.width = newW;
|
|
109
|
-
mask.height = newH;
|
|
110
|
-
if (mask.clip) {
|
|
111
|
-
const ratioX = widthChanged && prevW ? newW / prevW : 1;
|
|
112
|
-
const ratioY = heightChanged && prevH ? newH / prevH : 1;
|
|
113
|
-
const size = clipSizes?.[idx] ?? clipOriginalSize(mask.clip, null);
|
|
114
|
-
if (size.w && size.h) {
|
|
115
|
-
const oldCover = Math.max(prevW / size.w, prevH / size.h);
|
|
116
|
-
const newCover = Math.max(newW / size.w, newH / size.h);
|
|
117
|
-
const prevScale = mask.clip.scaleX || mask.clip.scaleY || 1;
|
|
118
|
-
const userFactor = oldCover ? prevScale / oldCover : 1;
|
|
119
|
-
const nextScale = newCover * (userFactor || 1);
|
|
120
|
-
mask.clip.scaleX = nextScale;
|
|
121
|
-
mask.clip.scaleY = nextScale;
|
|
122
|
-
}
|
|
123
|
-
mask.clip.clipX = (mask.clip.clipX || 0) * ratioX;
|
|
124
|
-
mask.clip.clipY = (mask.clip.clipY || 0) * ratioY;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return true;
|
|
128
|
-
};
|
|
129
|
-
/** Mask 序列化子对象的 clipImage 视图(供 PuzzleMaskView 构造;无 clipImage 返回 null) */
|
|
130
|
-
export const maskClipView = (raw) => {
|
|
131
|
-
const c = raw.clipImage;
|
|
132
|
-
if (!c || typeof c !== 'object' || typeof c.src !== 'string')
|
|
133
|
-
return null;
|
|
134
|
-
const o = c;
|
|
135
|
-
return {
|
|
136
|
-
scaleX: o.scaleX ?? 1,
|
|
137
|
-
scaleY: o.scaleY ?? 1,
|
|
138
|
-
clipX: o.clipX ?? 0,
|
|
139
|
-
clipY: o.clipY ?? 0,
|
|
140
|
-
width: o.width ?? 0,
|
|
141
|
-
height: o.height ?? 0
|
|
142
|
-
};
|
|
143
|
-
};
|