reacthub-pixitweenjs 0.2.109-alpha.7 → 0.3.0-alpha.3
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/LICENSE +8 -16
- package/LICENSE.md +79 -239
- package/README.md +241 -103
- package/dist/components/AepComposition/Aep3DPostFx.d.ts +7 -0
- package/dist/components/AepComposition/Aep3DPrecompPlane.d.ts +9 -0
- package/dist/components/AepComposition/Aep3DScene.d.ts +14 -0
- package/dist/components/AepComposition/Aep3DShapeMesh.d.ts +13 -0
- package/dist/components/AepComposition/Aep3DTextMesh.d.ts +17 -0
- package/dist/components/AepComposition/AepAssetResolver.d.ts +13 -0
- package/dist/components/AepComposition/AepAudioLayer.d.ts +28 -0
- package/dist/components/AepComposition/AepComposition.d.ts +16 -0
- package/dist/components/AepComposition/AepLayerProvider.d.ts +30 -0
- package/dist/components/AepComposition/AepLayerRouter.d.ts +5 -0
- package/dist/components/AepComposition/AepMsdfTextMesh.d.ts +17 -0
- package/dist/components/AepComposition/AepPrecompRenderContext.d.ts +23 -0
- package/dist/components/AepComposition/AepPrecompRenderer.d.ts +8 -0
- package/dist/components/AepComposition/AepTextOverrideContext.d.ts +8 -0
- package/dist/components/AepComposition/AepThemeContext.d.ts +8 -0
- package/dist/components/AepComposition/composeTransform3D.d.ts +27 -0
- package/dist/components/AepComposition/index.d.ts +39 -0
- package/dist/components/AepComposition/matteSourceIds.d.ts +2 -0
- package/dist/components/AepComposition/msdfAtlasRegistry.d.ts +16 -0
- package/dist/components/AepComposition/pathToThreeShape.d.ts +4 -0
- package/dist/components/AepComposition/resolveParentChain.d.ts +3 -0
- package/dist/components/AepComposition/resolvePostFxList.d.ts +2 -0
- package/dist/components/AepComposition/shouldSplitText.d.ts +26 -0
- package/dist/components/AepComposition/threeTextureFromPixi.d.ts +8 -0
- package/dist/components/AepComposition/useAepLayerTransform.d.ts +18 -0
- package/dist/components/AepComposition/useAepLayerTransform3D.d.ts +8 -0
- package/dist/components/AepComposition/useMsdfAtlasRegistry.d.ts +6 -0
- package/dist/components/AepComposition/usePixiRenderTexture.d.ts +14 -0
- package/dist/components/AepComposition/useResolveAsset.d.ts +8 -0
- package/dist/components/AepMask/AepMaskContainer.d.ts +9 -0
- package/dist/components/AepMask/PixiTrackMatte.d.ts +10 -0
- package/dist/components/AepMask/drawAepMask.d.ts +3 -0
- package/dist/components/AepMask/index.d.ts +5 -0
- package/dist/components/PixiAudioSprite/HowlerAudioSprite.d.ts +5 -7
- package/dist/components/PixiAudioSprite/PixiAudioSprite.d.ts +6 -2
- package/dist/components/PixiAudioSprite/useAudioVisualizer.d.ts +2 -2
- package/dist/components/PixiAudioSprite/wave-config.d.ts +0 -1
- package/dist/components/PixiGifSprite/PixiGifGsapSync.d.ts +11 -10
- package/dist/components/PixiImageSprite/PixiImageSprite.d.ts +11 -2
- package/dist/components/PixiLottieSprite/PixiLottieSprite.d.ts +5 -2
- package/dist/components/PixiNullObject/PixiNullObject.d.ts +25 -0
- package/dist/components/PixiNullObject/index.d.ts +2 -0
- package/dist/components/PixiPreComp/PixiPreComp.d.ts +29 -0
- package/dist/components/PixiPreComp/index.d.ts +3 -0
- package/dist/components/PixiPreComp/validatePrecompDepth.d.ts +2 -0
- package/dist/components/PixiRemotionSprite/PixiRemotionGifSprite.d.ts +24 -0
- package/dist/components/PixiRemotionSprite/PixiRemotionImageSprite.d.ts +18 -0
- package/dist/components/PixiRemotionSprite/PixiRemotionSprite.d.ts +5 -2
- package/dist/components/PixiRemotionSprite/PixiRemotionVideoCanvaSprite.d.ts +20 -0
- package/dist/components/PixiRemotionSprite/index.d.ts +4 -0
- package/dist/components/PixiSVGSprite/PixiMorphSvgSprite.d.ts +35 -0
- package/dist/components/PixiSVGSprite/PixiSvgPathSprite.d.ts +11 -4
- package/dist/components/PixiSVGSprite/index.d.ts +1 -0
- package/dist/components/PixiShapeLayer/PixiShapeLayer.d.ts +43 -0
- package/dist/components/PixiShapeLayer/drawShape.d.ts +20 -0
- package/dist/components/PixiShapeLayer/index.d.ts +4 -0
- package/dist/components/PixiShapeLayer/samplePath.d.ts +5 -0
- package/dist/components/PixiTextSprite/PixiTextSplit.d.ts +26 -0
- package/dist/components/PixiTextSprite/PixiTextSprite.d.ts +17 -5
- package/dist/components/PixiTextSprite/index.d.ts +3 -0
- package/dist/components/PixiTextSprite/resolveTextSplitFills.d.ts +27 -0
- package/dist/components/PixiTextSprite/textAnimator.d.ts +22 -0
- package/dist/components/PixiThreeSprite/PixiThreeSprite.d.ts +14 -0
- package/dist/components/PixiThreeSprite/index.d.ts +2 -0
- package/dist/components/PixiUnifiedTransformer/PixiUnifiedTransformer.d.ts +20 -8
- package/dist/components/PixiVideoSprite/PixiVideoCanvasSync.d.ts +3 -1
- package/dist/components/PixiVideoSprite/PixiVideoSprite.d.ts +5 -2
- package/dist/components/index.d.ts +5 -0
- package/dist/events/Events.d.ts +0 -1
- package/dist/hocs/AbstractContainer.d.ts +3 -1
- package/dist/hocs/BorderMaskContainer.d.ts +28 -0
- package/dist/hocs/OverlayTilingSprite.d.ts +3 -3
- package/dist/hocs/drawMaskShape.d.ts +3 -0
- package/dist/hocs/index.d.ts +5 -0
- package/dist/hooks/aep/buildAudioLevelTimeline.d.ts +7 -0
- package/dist/hooks/aep/buildBezierPathTimeline.d.ts +13 -0
- package/dist/hooks/aep/buildColorValueTimeline.d.ts +24 -0
- package/dist/hooks/aep/buildLayerTimeline.d.ts +20 -0
- package/dist/hooks/aep/buildScalarValueTimeline.d.ts +6 -0
- package/dist/hooks/aep/buildVec2ValueTimeline.d.ts +17 -0
- package/dist/hooks/aep/easeCache.d.ts +3 -0
- package/dist/hooks/aep/effectRegistry.d.ts +5 -0
- package/dist/hooks/aep/effects/brightnessContrast.d.ts +2 -0
- package/dist/hooks/aep/effects/dropShadow.d.ts +2 -0
- package/dist/hooks/aep/effects/fastBoxBlur.d.ts +2 -0
- package/dist/hooks/aep/effects/gaussianBlur.d.ts +2 -0
- package/dist/hooks/aep/effects/glow.d.ts +2 -0
- package/dist/hooks/aep/effects/hueSaturation.d.ts +2 -0
- package/dist/hooks/aep/effects/index.d.ts +9 -0
- package/dist/hooks/aep/effects/levels.d.ts +2 -0
- package/dist/hooks/aep/effects/tint.d.ts +2 -0
- package/dist/hooks/aep/effects/types.d.ts +8 -0
- package/dist/hooks/aep/index.d.ts +22 -0
- package/dist/hooks/aep/interpolateBezierPath.d.ts +3 -0
- package/dist/hooks/aep/sampleAnimatable.d.ts +13 -0
- package/dist/hooks/aep/useAepBezierPathAnimator.d.ts +12 -0
- package/dist/hooks/aep/useAepColorAnimator.d.ts +11 -0
- package/dist/hooks/aep/useAepCurrentFrame.d.ts +1 -0
- package/dist/hooks/aep/useAepEffectKeyframes.d.ts +4 -0
- package/dist/hooks/aep/useAepEffects.d.ts +3 -0
- package/dist/hooks/aep/useAepKeyframes.d.ts +15 -0
- package/dist/hooks/aep/useAepTextLayout.d.ts +12 -0
- package/dist/hooks/aep/useAepValueAnimator.d.ts +2 -0
- package/dist/hooks/aep/useAepVec2Animator.d.ts +10 -0
- package/dist/hooks/aep/useTypefaceMetrics.d.ts +2 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useSpriteFilters.d.ts +39 -0
- package/dist/hooks/withFiltersHook.d.ts +1 -1
- package/dist/importers/aep/bodymovin-color-controls.d.ts +23 -0
- package/dist/importers/aep/bodymovin-color.d.ts +1 -0
- package/dist/importers/aep/bodymovin-keyframe.d.ts +42 -0
- package/dist/importers/aep/bodymovin-layer.d.ts +84 -0
- package/dist/importers/aep/bodymovin-transform.d.ts +12 -0
- package/dist/importers/aep/bodymovin.d.ts +7 -0
- package/dist/importers/aep/bodymovinCameras.d.ts +34 -0
- package/dist/importers/aep/bodymovinExtensions.d.ts +3 -0
- package/dist/importers/aep/bodymovinTextRuns.d.ts +13 -0
- package/dist/importers/aep/index.d.ts +7 -0
- package/dist/importers/aep/lottieLint.d.ts +23 -0
- package/dist/importers/aep/lottieLint.rules.d.ts +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +60038 -29928
- package/dist/index.umd.js +4351 -1851
- package/dist/lib/pixi-essentials/bounds/AxisAlignedBounds.d.ts +121 -0
- package/dist/lib/pixi-essentials/bounds/OrientedBounds.d.ts +103 -0
- package/dist/lib/pixi-essentials/bounds/index.d.ts +2 -0
- package/dist/lib/pixi-essentials/index.d.ts +6 -0
- package/dist/lib/pixi-essentials/object-pool/AverageProvider.d.ts +28 -0
- package/dist/lib/pixi-essentials/object-pool/ObjectPool.d.ts +103 -0
- package/dist/lib/pixi-essentials/object-pool/ObjectPoolFactory.d.ts +40 -0
- package/dist/lib/pixi-essentials/object-pool/index.d.ts +2 -0
- package/dist/lib/pixi-essentials/react-bindings/Transformer.d.ts +74 -0
- package/dist/lib/pixi-essentials/react-bindings/index.d.ts +3 -0
- package/dist/lib/pixi-essentials/react-bindings/utils/applyEventProps.d.ts +13 -0
- package/dist/lib/pixi-essentials/transformer/Transformer.d.ts +728 -0
- package/dist/lib/pixi-essentials/transformer/TransformerHandle.d.ts +142 -0
- package/dist/lib/pixi-essentials/transformer/TransformerWireframe.d.ts +54 -0
- package/dist/lib/pixi-essentials/transformer/index.d.ts +5 -0
- package/dist/lib/pixi-essentials/transformer/utils/decomposeTransform.d.ts +11 -0
- package/dist/lib/pixi-essentials/transformer/utils/distanceToLine.d.ts +7 -0
- package/dist/lib/pixi-essentials/transformer/utils/multiplyTransform.d.ts +17 -0
- package/dist/lib/pixi-essentials/transformer/utils/skewTransform.d.ts +13 -0
- package/dist/types/BaseProps.d.ts +11 -3
- package/dist/types/MaskTypes.d.ts +10 -0
- package/dist/types/OverlayTypes.d.ts +9 -0
- package/dist/types/aep/asset.d.ts +43 -0
- package/dist/types/aep/camera.d.ts +778 -0
- package/dist/types/aep/composition.d.ts +82 -0
- package/dist/types/aep/effect.d.ts +137 -0
- package/dist/types/aep/index.d.ts +14 -0
- package/dist/types/aep/layer.d.ts +21579 -0
- package/dist/types/aep/light.d.ts +781 -0
- package/dist/types/aep/mask.d.ts +193 -0
- package/dist/types/aep/parse.d.ts +11 -0
- package/dist/types/aep/postFx.d.ts +107 -0
- package/dist/types/aep/text-animator.d.ts +687 -0
- package/dist/types/aep/text-runs.d.ts +234 -0
- package/dist/types/aep/theme.d.ts +72 -0
- package/dist/types/aep/transform.d.ts +285 -0
- package/dist/types/aep/transform3D.d.ts +171 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/utils/AppStateProvider.d.ts +1 -0
- package/dist/utils/AppWrapper.d.ts +3 -0
- package/dist/utils/ContextBridge.d.ts +1 -1
- package/dist/utils/GsapAnims.d.ts +0 -1
- package/dist/utils/InteractionManager.d.ts +1 -10
- package/dist/utils/aeMath/zoomToFov.d.ts +1 -0
- package/dist/utils/areSpritePropsEqual.d.ts +8 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/isExternalUrl.d.ts +1 -0
- package/dist/utils/loadSpriteTexture.d.ts +10 -0
- package/dist/utils/msdf/computeInstanceMatrix.d.ts +18 -0
- package/dist/utils/msdf/index.d.ts +4 -0
- package/dist/utils/msdf/loadMsdfAtlas.d.ts +9 -0
- package/dist/utils/msdf/msdfShader.d.ts +2 -0
- package/dist/utils/msdf/types.d.ts +49 -0
- package/dist/utils/text/resolveTextRuns.d.ts +8 -0
- package/dist/utils/textLayout/alignLines.d.ts +15 -0
- package/dist/utils/textLayout/applyVerticals.d.ts +14 -0
- package/dist/utils/textLayout/breakLines.d.ts +14 -0
- package/dist/utils/textLayout/canvasMetricsProvider.d.ts +6 -0
- package/dist/utils/textLayout/index.d.ts +7 -0
- package/dist/utils/textLayout/layoutText.d.ts +2 -0
- package/dist/utils/textLayout/metricsCache.d.ts +9 -0
- package/dist/utils/textLayout/pixiCanvasMetricsProvider.d.ts +6 -0
- package/dist/utils/textLayout/shapeRuns.d.ts +18 -0
- package/dist/utils/textLayout/typefaceMetricsProvider.d.ts +19 -0
- package/dist/utils/textLayout/types.d.ts +61 -0
- package/dist/utils/textLayout/unicode.d.ts +2 -0
- package/package.json +72 -47
- package/dist/assets/icon/transformericons/icons.d.ts +0 -8
- package/dist/components/PixiAudioSprite/PixiAudioSprite.stories.d.ts +0 -12
- package/dist/components/PixiGifSprite/PixiGifSprite.stories.d.ts +0 -163
- package/dist/components/PixiImageSprite/PixiImageSprite.stories.d.ts +0 -150
- package/dist/components/PixiLottieSprite/PixiLottieSprite.stories.d.ts +0 -159
- package/dist/components/PixiSVGSprite/PixiSvgPathSprite.stories.d.ts +0 -131
- package/dist/components/PixiSequence/PixiSequence.stories.d.ts +0 -33
- package/dist/components/PixiTextSprite/PixiTextSprite.stories.d.ts +0 -140
- package/dist/components/PixiVideoSprite/PixiVideoSprite.stories.d.ts +0 -146
- package/dist/favicon.svg +0 -41
- package/dist/hooks/withEffectsHook.d.ts +0 -5
- package/dist/pixitweenjs-logo-dark.svg +0 -98
- package/dist/pixitweenjs-logo.svg +0 -97
- package/dist/stories/Features/TestHowlerAudioFiles.d.ts +0 -2
- package/dist/stories/Features/TimelineAnimations.d.ts +0 -15
- package/dist/stories/Features/TimelineTest.d.ts +0 -15
- package/dist/stories/Features/TimelineTest.stories.d.ts +0 -23
- package/dist/stories/Features/TimelineTestAudios.d.ts +0 -15
- package/dist/stories/Features/TimelineTestWithVideos.d.ts +0 -15
- package/dist/stories/Features/TimelineWithGif.d.ts +0 -21
- package/dist/stories/Features/common.tests.d.ts +0 -411
- /package/dist/{.gitkeep → utils/pixiExtend.d.ts} +0 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
import { Container, Matrix, Point, Cursor, FederatedPointerEvent } from 'pixi.js';
|
|
2
|
+
import { OrientedBounds } from '../bounds/index';
|
|
3
|
+
import { TransformerHandle, ITransformerHandleStyle } from './TransformerHandle';
|
|
4
|
+
import { TransformerWireframe } from './TransformerWireframe';
|
|
5
|
+
/**
|
|
6
|
+
* The handles used for rotation.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
export type RotateHandle = 'rotator' | 'boxRotateTopLeft' | 'boxRotateTopRight' | 'boxRotateBottomLeft' | 'boxRotateBottomRight';
|
|
12
|
+
/**
|
|
13
|
+
* The handles used for scaling.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
export type ScaleHandle = 'topLeft' | 'topCenter' | 'topRight' | 'middleLeft' | 'middleCenter' | 'middleRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
19
|
+
/**
|
|
20
|
+
* The handles used for skewing
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export type SkewHandle = 'skewHorizontal' | 'skewVertical';
|
|
26
|
+
/**
|
|
27
|
+
* All the handles provided by {@link Transformer}.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
export type Handle = RotateHandle | ScaleHandle | SkewHandle;
|
|
33
|
+
/**
|
|
34
|
+
* Specific cursors for each handle
|
|
35
|
+
*
|
|
36
|
+
* @ignore
|
|
37
|
+
*/
|
|
38
|
+
export declare const HANDLE_TO_CURSOR: {
|
|
39
|
+
[H in Handle]?: Cursor;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Per-element dimensions snapshot fired on `transformcommit`.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export interface ITransformerElementDims {
|
|
47
|
+
/** Local x position of the element (relative to its parent). */
|
|
48
|
+
x: number;
|
|
49
|
+
/** Local y position. */
|
|
50
|
+
y: number;
|
|
51
|
+
/** Visible width (`displayObject.width`). 0 when not measurable. */
|
|
52
|
+
width: number;
|
|
53
|
+
/** Visible height (`displayObject.height`). 0 when not measurable. */
|
|
54
|
+
height: number;
|
|
55
|
+
/** Local rotation in radians. */
|
|
56
|
+
rotation: number;
|
|
57
|
+
/** Local scale on the x-axis. */
|
|
58
|
+
scaleX: number;
|
|
59
|
+
/** Local scale on the y-axis. */
|
|
60
|
+
scaleY: number;
|
|
61
|
+
/** Local x-skew in radians. */
|
|
62
|
+
skewX: number;
|
|
63
|
+
/** Local y-skew in radians. */
|
|
64
|
+
skewY: number;
|
|
65
|
+
/** Local x-pivot. */
|
|
66
|
+
pivotX: number;
|
|
67
|
+
/** Local y-pivot. */
|
|
68
|
+
pivotY: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Group-bounding-box snapshot. World space coordinates.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export interface ITransformerGroupBoundsSnapshot {
|
|
76
|
+
/** Top-left corner x of the inner (unrotated) box. */
|
|
77
|
+
x: number;
|
|
78
|
+
/** Top-left corner y of the inner (unrotated) box. */
|
|
79
|
+
y: number;
|
|
80
|
+
/** Inner box width. */
|
|
81
|
+
width: number;
|
|
82
|
+
/** Inner box height. */
|
|
83
|
+
height: number;
|
|
84
|
+
/** Rotation of the box in radians. */
|
|
85
|
+
rotation: number;
|
|
86
|
+
/** Centre point x (also the rotation pivot). */
|
|
87
|
+
centerX: number;
|
|
88
|
+
/** Centre point y. */
|
|
89
|
+
centerY: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Payload fired with the `transformcommit` event.
|
|
93
|
+
*
|
|
94
|
+
* Consumers can read `elements[0]` for the single-select case, or iterate
|
|
95
|
+
* `elements` for multi-select. `groupBounds` is always present.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export interface ITransformCommitPayload {
|
|
100
|
+
/** Bounding box of the whole group in world coordinates. */
|
|
101
|
+
groupBounds: ITransformerGroupBoundsSnapshot;
|
|
102
|
+
/** Per-element local dimensions, in `group` order. */
|
|
103
|
+
elements: ITransformerElementDims[];
|
|
104
|
+
/**
|
|
105
|
+
* The handle that initiated the interaction (`null` for translate/free
|
|
106
|
+
* drag of the bounding box). Mirrors the `transformstart` payload.
|
|
107
|
+
*/
|
|
108
|
+
handle: Handle | null;
|
|
109
|
+
/** Kind of transformation that just committed. */
|
|
110
|
+
transformType: 'translate' | 'scale' | 'rotate' | 'skew' | 'none';
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @ignore
|
|
114
|
+
*/
|
|
115
|
+
export interface ITransformerStyle {
|
|
116
|
+
color: number;
|
|
117
|
+
thickness: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Color theme configuration for the transformer
|
|
121
|
+
*/
|
|
122
|
+
export interface ITransformerColorTheme {
|
|
123
|
+
/** Primary color for handles and wireframe */
|
|
124
|
+
primary?: number;
|
|
125
|
+
/** Secondary color for accents */
|
|
126
|
+
secondary?: number;
|
|
127
|
+
/** Background color for handles */
|
|
128
|
+
background?: number;
|
|
129
|
+
/** Glow effect color */
|
|
130
|
+
glow?: number;
|
|
131
|
+
/** Glow intensity (0-1) */
|
|
132
|
+
glowIntensity?: number;
|
|
133
|
+
/** Background color for rotator handle (SVG circle) */
|
|
134
|
+
rotatorBackground?: string;
|
|
135
|
+
/** Arrow color for rotator handle (SVG paths) */
|
|
136
|
+
rotatorArrow?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Configuration for the rotator anchor line
|
|
140
|
+
*/
|
|
141
|
+
export interface IRotatorAnchorConfig {
|
|
142
|
+
/** Whether the rotator anchor is enabled */
|
|
143
|
+
enabled?: boolean;
|
|
144
|
+
/** Start position as percentage from bounding box (0-1) */
|
|
145
|
+
startPosition?: number;
|
|
146
|
+
/** Length of the line segment as percentage of total distance (0-1) */
|
|
147
|
+
segmentLength?: number;
|
|
148
|
+
/** Thickness of the anchor line */
|
|
149
|
+
thickness?: number;
|
|
150
|
+
/** Color of the anchor line (overrides theme) */
|
|
151
|
+
color?: number;
|
|
152
|
+
/** Style of the anchor line */
|
|
153
|
+
style?: 'solid' | 'dashed' | 'dotted';
|
|
154
|
+
/** Dash pattern for dashed style [dashLength, gapLength] */
|
|
155
|
+
dashPattern?: [number, number];
|
|
156
|
+
/** Dot pattern for dotted style [dotSize, gapLength] */
|
|
157
|
+
dotPattern?: [number, number];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
export interface ITransformerCursors {
|
|
163
|
+
default: string;
|
|
164
|
+
boxRotate?: string;
|
|
165
|
+
boxScaleLeft?: string;
|
|
166
|
+
boxScaleTop?: string;
|
|
167
|
+
boxScaleRight?: string;
|
|
168
|
+
boxScaleBottom?: string;
|
|
169
|
+
translate?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
export interface ITransformerOptions {
|
|
175
|
+
/** "all" or "groupOnly". "groupOnly" won't show individual bounding boxes. */
|
|
176
|
+
boundingBoxes?: 'all' | 'groupOnly' | 'none';
|
|
177
|
+
/** Enable box rotation by dragging outside of corners */
|
|
178
|
+
boxRotationEnabled?: boolean;
|
|
179
|
+
/** The radial tolerance for box rotation */
|
|
180
|
+
boxRotationTolerance?: number;
|
|
181
|
+
/** Enable box scaling by dragging at the edges */
|
|
182
|
+
boxScalingEnabled?: boolean;
|
|
183
|
+
/** The tolerance for scaling at the edges */
|
|
184
|
+
boxScalingTolerance: number;
|
|
185
|
+
/** Whether scaling should always be centered */
|
|
186
|
+
centeredScaling: boolean;
|
|
187
|
+
/** */
|
|
188
|
+
cursors?: ITransformerCursors;
|
|
189
|
+
/** Specifically define which handles are to be enabled */
|
|
190
|
+
enabledHandles?: Array<Handle>;
|
|
191
|
+
/** The group of display-objects being transformed */
|
|
192
|
+
group: Container[];
|
|
193
|
+
/** A custom transformer-handle class */
|
|
194
|
+
handleConstructor: typeof TransformerHandle;
|
|
195
|
+
/** Styling options for the handle. These cannot be modified afterwards! */
|
|
196
|
+
handleStyle: Partial<ITransformerHandleStyle>;
|
|
197
|
+
/** Lock aspect ratio when scaling using one of the corner handles. */
|
|
198
|
+
lockAspectRatio?: boolean;
|
|
199
|
+
/** Whether rotate handles are enabled */
|
|
200
|
+
rotateEnabled?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The rotation snap angles, in radians. By default, transformer will
|
|
203
|
+
* snap for each 1/8th of a revolution.
|
|
204
|
+
*/
|
|
205
|
+
rotationSnaps?: number[];
|
|
206
|
+
/** The snap tolerance for rotation in radians */
|
|
207
|
+
rotationSnapTolerance?: number;
|
|
208
|
+
/** Whether scale handles are enabled */
|
|
209
|
+
scaleEnabled?: boolean;
|
|
210
|
+
/** Whether skew handles are enabled */
|
|
211
|
+
skewEnabled?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Distance of skew handles from center of transformer box
|
|
214
|
+
* (`skewTransform` should be enabled)
|
|
215
|
+
*/
|
|
216
|
+
skewRadius?: number;
|
|
217
|
+
/** The skew snap angles, in radians. */
|
|
218
|
+
skewSnaps?: number[];
|
|
219
|
+
/** The skew snap tolerance angle. */
|
|
220
|
+
skewSnapTolerance?: number;
|
|
221
|
+
/** The root object in your scene in which the transformed objects exist. */
|
|
222
|
+
stage: Container;
|
|
223
|
+
/** Whether dragging the transformer should move the group */
|
|
224
|
+
translateEnabled?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Whether the transformer should reset the wireframe's rotation
|
|
227
|
+
* after a rotator handle is "defocused".
|
|
228
|
+
*/
|
|
229
|
+
transientGroupTilt?: boolean;
|
|
230
|
+
/** Styling options for the wireframe. */
|
|
231
|
+
wireframeStyle: Partial<ITransformerStyle>;
|
|
232
|
+
/** Color theme configuration for the entire transformer */
|
|
233
|
+
colorTheme?: ITransformerColorTheme;
|
|
234
|
+
/** Configuration for the rotator anchor line */
|
|
235
|
+
rotatorAnchor?: IRotatorAnchorConfig;
|
|
236
|
+
/** Color for individual element borders when multiple elements are selected */
|
|
237
|
+
individualBorderColor?: number;
|
|
238
|
+
/** Thickness for individual borders (defaults to wireframeStyle.thickness) */
|
|
239
|
+
individualBorderThickness?: number;
|
|
240
|
+
/** Alpha/opacity for individual borders (0-1) */
|
|
241
|
+
individualBorderAlpha?: number;
|
|
242
|
+
/** Style for individual element borders: 'solid' | 'dashed' | 'dotted' */
|
|
243
|
+
individualBorderStyle?: 'solid' | 'dashed' | 'dotted';
|
|
244
|
+
/** Dash pattern for individual borders [dashLength, gapLength] */
|
|
245
|
+
individualBorderDashPattern?: [number, number];
|
|
246
|
+
/** Enable nested selection (click to select individual elements within group) */
|
|
247
|
+
nestedSelectionEnabled?: boolean;
|
|
248
|
+
/** Color for the focused/selected inner element border */
|
|
249
|
+
focusedElementBorderColor?: number;
|
|
250
|
+
/** Thickness for focused element border */
|
|
251
|
+
focusedElementBorderThickness?: number;
|
|
252
|
+
/** Style for focused element border: 'solid' | 'dashed' | 'dotted' */
|
|
253
|
+
focusedElementBorderStyle?: 'solid' | 'dashed' | 'dotted';
|
|
254
|
+
/** Dash pattern for focused element border [dashLength, gapLength] */
|
|
255
|
+
focusedElementBorderDashPattern?: [number, number];
|
|
256
|
+
/** Whether to show individual borders for non-focused elements */
|
|
257
|
+
showNonFocusedBorders?: boolean;
|
|
258
|
+
/** Threshold in pixels to distinguish click from drag (default: 5) */
|
|
259
|
+
clickThreshold?: number;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* {@code Transformer} provides an interactive interface for editing the transforms in a group. It supports translating,
|
|
263
|
+
* scaling, rotating, and skewing display-objects both through interaction and code.
|
|
264
|
+
*
|
|
265
|
+
* A transformer operates in world-space, and it is best to not position, scale, rotate, or skew one. If you do so, the
|
|
266
|
+
* wireframe itself will not distort (i.e. will adapt _against_ your transforms). However, the wireframe may become
|
|
267
|
+
* thinner/thicker and the handles will scale & rotate. For example, setting `transformer.scale.set(2)` will make the handles
|
|
268
|
+
* twice as big, but will not scale the wireframe (assuming the display-object group itself has not been
|
|
269
|
+
* scaled up).
|
|
270
|
+
*
|
|
271
|
+
* To enable scaling via dragging the edges of the wireframe, set `boxScalingEnabled` to `true`.
|
|
272
|
+
*
|
|
273
|
+
* NOTE: The transformer needs to capture all interaction events that would otherwise go to the display-objects in the
|
|
274
|
+
* group. Hence, it must be placed after them in the scene graph.
|
|
275
|
+
*
|
|
276
|
+
* @extends PIXI.Container
|
|
277
|
+
*/
|
|
278
|
+
export declare class Transformer extends Container {
|
|
279
|
+
/** The group of display-objects under transformation. */
|
|
280
|
+
private _group;
|
|
281
|
+
/** Getter for the group property */
|
|
282
|
+
get group(): Container[];
|
|
283
|
+
/** Setter for the group property - handles React prop updates */
|
|
284
|
+
set group(value: Container[]);
|
|
285
|
+
/**
|
|
286
|
+
* Specify which bounding boxes should be drawn in the wireframe.
|
|
287
|
+
*
|
|
288
|
+
* "groupOnly" won't show individual bounding boxes. "none" will not render anything visible.
|
|
289
|
+
*
|
|
290
|
+
* @default "all"
|
|
291
|
+
*/
|
|
292
|
+
boundingBoxes: 'all' | 'groupOnly' | 'none';
|
|
293
|
+
/** Set this to enable rotation at the four corners */
|
|
294
|
+
boxRotationEnabled: boolean;
|
|
295
|
+
/** The thickness of the box rotation area */
|
|
296
|
+
boxRotationTolerance: number;
|
|
297
|
+
/** Set this to enable scaling by dragging at the edges of the bounding box */
|
|
298
|
+
boxScalingEnabled: boolean;
|
|
299
|
+
/** The padding around the bounding-box to capture dragging on the edges. */
|
|
300
|
+
boxScalingTolerance: number;
|
|
301
|
+
/** This will prevent the wireframe's center from shifting on scaling. */
|
|
302
|
+
centeredScaling: boolean;
|
|
303
|
+
/** Cursors to use in the transformer */
|
|
304
|
+
cursors: ITransformerCursors;
|
|
305
|
+
/** Color for individual element borders */
|
|
306
|
+
individualBorderColor: number;
|
|
307
|
+
/** Thickness for individual element borders */
|
|
308
|
+
individualBorderThickness?: number;
|
|
309
|
+
/** Alpha for individual element borders */
|
|
310
|
+
individualBorderAlpha: number;
|
|
311
|
+
/** Style for individual element borders */
|
|
312
|
+
individualBorderStyle: 'solid' | 'dashed' | 'dotted';
|
|
313
|
+
/** Dash pattern for individual borders */
|
|
314
|
+
individualBorderDashPattern: [number, number];
|
|
315
|
+
/** Enable nested selection (click to select individual elements within group) */
|
|
316
|
+
nestedSelectionEnabled: boolean;
|
|
317
|
+
/** Color for focused element border */
|
|
318
|
+
focusedElementBorderColor: number;
|
|
319
|
+
/** Thickness for focused element border */
|
|
320
|
+
focusedElementBorderThickness?: number;
|
|
321
|
+
/** Style for focused element border */
|
|
322
|
+
focusedElementBorderStyle: 'solid' | 'dashed' | 'dotted';
|
|
323
|
+
/** Dash pattern for focused element border */
|
|
324
|
+
focusedElementBorderDashPattern: [number, number];
|
|
325
|
+
/** Show borders for non-focused elements */
|
|
326
|
+
showNonFocusedBorders: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Flags whether the transformer should **not** redraw each frame (good for performance)
|
|
329
|
+
*
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
lazyMode: boolean;
|
|
333
|
+
/** Set this when you want the transformer to redraw when using {@link Transformer#lazyMode lazyMode}. */
|
|
334
|
+
lazyDirty: boolean;
|
|
335
|
+
/** Lock aspect ratio when using one of the corner handles. */
|
|
336
|
+
lockAspectRatio: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* This is used when the display-object group are rendered through a projection transformation (i.e. are disconnected
|
|
339
|
+
* from the transformer in the scene graph). The transformer project itself into their frame-of-reference using this
|
|
340
|
+
* transform.
|
|
341
|
+
*
|
|
342
|
+
* Specifically, the projection-transform converts points from the group's world space to the transformer's world
|
|
343
|
+
* space. If you are not applying a projection on the transformer itself, this means it is the group's
|
|
344
|
+
* world-to-screen transformation.
|
|
345
|
+
*/
|
|
346
|
+
projectionTransform: Matrix;
|
|
347
|
+
/** The angles at which rotation should snap. */
|
|
348
|
+
rotationSnaps: number[];
|
|
349
|
+
/** The maximum angular difference for snapping rotation. */
|
|
350
|
+
rotationSnapTolerance: number;
|
|
351
|
+
/** The distance of skewing handles from the group's center. */
|
|
352
|
+
skewRadius: number;
|
|
353
|
+
/** The angles at which both the horizontal & vertical skew handles should snap. */
|
|
354
|
+
skewSnaps: number[];
|
|
355
|
+
/**
|
|
356
|
+
* The maximum angular difference for snapping skew handles.
|
|
357
|
+
*/
|
|
358
|
+
skewSnapTolerance: number;
|
|
359
|
+
/**
|
|
360
|
+
* The root object in your scene in which objects can move.
|
|
361
|
+
*
|
|
362
|
+
* {@code Transformer} will subscribe to this object for `pointermove` events, if provided. This
|
|
363
|
+
* should be used when:
|
|
364
|
+
*
|
|
365
|
+
* * {@link InteractionManager.moveWhenInside moveWhenInside} is enabled on the interaction plugin.
|
|
366
|
+
* * {@link EventBoundary.moveOnAll moveOnAll} is not turned off when using the new {@link EventSystem}.
|
|
367
|
+
*
|
|
368
|
+
* Otherwise, the transformer will receive **not** `pointermove` events when the user drags fast enough that
|
|
369
|
+
* the cursor leaves the transformer's bounds.
|
|
370
|
+
*
|
|
371
|
+
* The stage must be fully interactive in the area you want objects to move. Generally, this is the
|
|
372
|
+
* whole canvas:
|
|
373
|
+
*
|
|
374
|
+
* ```ts
|
|
375
|
+
* stage.interactive = true;
|
|
376
|
+
* stage.hitArea = renderer.screen;// or pass custom rect for the canvas dimensions
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
stage: Container | null;
|
|
380
|
+
/**
|
|
381
|
+
* This will enable translation on dragging the transformer. By default, it is turned on.
|
|
382
|
+
*
|
|
383
|
+
* @default true
|
|
384
|
+
*/
|
|
385
|
+
translateEnabled: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* This will reset the rotation angle after the user finishes rotating a group with more than one display-object.
|
|
388
|
+
*
|
|
389
|
+
* @default true
|
|
390
|
+
*/
|
|
391
|
+
transientGroupTilt: boolean;
|
|
392
|
+
/** The last calculated bounds of the whole group being transformed */
|
|
393
|
+
protected groupBounds: OrientedBounds;
|
|
394
|
+
/** Object mapping handle-names to the handle display-objects. */
|
|
395
|
+
protected handles: {
|
|
396
|
+
[H in Handle]?: TransformerHandle;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Positions of the various handles
|
|
400
|
+
*
|
|
401
|
+
* @internal
|
|
402
|
+
* @ignore
|
|
403
|
+
*/
|
|
404
|
+
handleAnchors: {
|
|
405
|
+
[H in Handle]: Point;
|
|
406
|
+
};
|
|
407
|
+
/** Draws the bounding boxes */
|
|
408
|
+
protected wireframe: TransformerWireframe;
|
|
409
|
+
/** @see Transformer#enabledHandles */
|
|
410
|
+
protected _enabledHandles: Handle[] | undefined;
|
|
411
|
+
/** @see Transformer#rotateEnabled */
|
|
412
|
+
protected _rotateEnabled: boolean;
|
|
413
|
+
/** @see Transformer#scaleEnabled */
|
|
414
|
+
protected _scaleEnabled: boolean;
|
|
415
|
+
/** @see Transformer#skewEnabled */
|
|
416
|
+
protected _skewEnabled: boolean;
|
|
417
|
+
/** The horizontal skew value. Rotating the group by 𝜽 will also change this value by 𝜽. */
|
|
418
|
+
protected _skewX: number;
|
|
419
|
+
/** The vertical skew value. Rotating the group by 𝜽 will also change this value by 𝜽. */
|
|
420
|
+
protected _skewY: number;
|
|
421
|
+
/** The currently grabbed handle. This can be used to get the type of transformation. */
|
|
422
|
+
protected _transformHandle: Handle | null;
|
|
423
|
+
/** The current type of transform being applied by the user. */
|
|
424
|
+
protected _transformType: 'translate' | 'scale' | 'rotate' | 'skew' | 'none';
|
|
425
|
+
/** The style applied on transformer handles */
|
|
426
|
+
protected _handleStyle: Partial<ITransformerHandleStyle>;
|
|
427
|
+
/** The wireframe style applied on the transformer */
|
|
428
|
+
protected _wireframeStyle: Partial<ITransformerStyle>;
|
|
429
|
+
/** The color theme applied on the transformer */
|
|
430
|
+
protected _colorTheme: ITransformerColorTheme;
|
|
431
|
+
/** The rotator anchor configuration */
|
|
432
|
+
protected _rotatorAnchorConfig: IRotatorAnchorConfig;
|
|
433
|
+
/** Index of currently focused element within the group (-1 = none focused) */
|
|
434
|
+
protected _focusedElementIndex: number;
|
|
435
|
+
/** Map to track which display object corresponds to which index */
|
|
436
|
+
protected _elementIndexMap: WeakMap<Container, number>;
|
|
437
|
+
private _pointerDown;
|
|
438
|
+
private _pointerDragging;
|
|
439
|
+
private _pointerPosition;
|
|
440
|
+
private _pointerMoveTarget;
|
|
441
|
+
private _transformStarted;
|
|
442
|
+
/** Threshold in pixels to distinguish click from drag */
|
|
443
|
+
private _clickThreshold;
|
|
444
|
+
/** Position where pointer was initially pressed */
|
|
445
|
+
private _clickStartPosition;
|
|
446
|
+
/** Index of element that was clicked (before drag threshold) */
|
|
447
|
+
private _elementClickCandidate;
|
|
448
|
+
/**
|
|
449
|
+
* | Handle | Type | Notes |
|
|
450
|
+
* | --------------------- | ------------------------ | ----- |
|
|
451
|
+
* | rotator | Rotate | |
|
|
452
|
+
* | boxRotateTopLeft | Rotate | Invisible |
|
|
453
|
+
* | boxRotateTopRight | Rotate | Invisible |
|
|
454
|
+
* | boxRotateBottomLeft | Rotate | Invisible |
|
|
455
|
+
* | boxRotateBottomRight | Rotate | Invisible |
|
|
456
|
+
* | topLeft | Scale | |
|
|
457
|
+
* | topCenter | Scale | |
|
|
458
|
+
* | topRight | Scale | |
|
|
459
|
+
* | middleLeft | Scale | |
|
|
460
|
+
* | middleCenter | Scale | This cannot be enabled! |
|
|
461
|
+
* | middleRight | Scale | |
|
|
462
|
+
* | bottomLeft | Scale | |
|
|
463
|
+
* | bottomCenter | Scale | |
|
|
464
|
+
* | bottomRight | Scale | |
|
|
465
|
+
* | skewHorizontal | Skew | Applies vertical shear. Handle segment is horizontal at skew.y = 0! |
|
|
466
|
+
* | skewVertical | Skew | Applied horizontal shear. Handle segment is vertical at skew.x = 0! |
|
|
467
|
+
*/
|
|
468
|
+
constructor(options?: Partial<ITransformerOptions>);
|
|
469
|
+
/** The list of enabled handles, if applied manually. */
|
|
470
|
+
get enabledHandles(): Array<Handle> | undefined;
|
|
471
|
+
/** Click vs drag threshold in pixels. */
|
|
472
|
+
get clickThreshold(): number;
|
|
473
|
+
set clickThreshold(value: number);
|
|
474
|
+
set enabledHandles(value: Array<Handle> | undefined);
|
|
475
|
+
/** The currently applied handle style. If you have edited the transformer handles directly, this may be inaccurate. */
|
|
476
|
+
get handleStyle(): Partial<ITransformerHandleStyle>;
|
|
477
|
+
set handleStyle(value: Partial<ITransformerHandleStyle>);
|
|
478
|
+
/** This will enable the rotate handles. */
|
|
479
|
+
get rotateEnabled(): boolean;
|
|
480
|
+
set rotateEnabled(value: boolean);
|
|
481
|
+
/** This will enable the scale handles. */
|
|
482
|
+
get scaleEnabled(): boolean;
|
|
483
|
+
set scaleEnabled(value: boolean);
|
|
484
|
+
/** This will enable the skew handles. */
|
|
485
|
+
get skewEnabled(): boolean;
|
|
486
|
+
set skewEnabled(value: boolean);
|
|
487
|
+
/**
|
|
488
|
+
* This is the type of transformation being applied by the user on the group. It can be inaccurate if you call one of
|
|
489
|
+
* `translateGroup`, `scaleGroup`, `rotateGroup`, `skewGroup` without calling `commitGroup` afterwards.
|
|
490
|
+
*
|
|
491
|
+
* @readonly
|
|
492
|
+
*/
|
|
493
|
+
get transformType(): 'translate' | 'scale' | 'rotate' | 'skew' | 'none';
|
|
494
|
+
/** The currently applied wireframe style. */
|
|
495
|
+
get wireframeStyle(): Partial<ITransformerStyle>;
|
|
496
|
+
set wireframeStyle(value: Partial<ITransformerStyle>);
|
|
497
|
+
/** The currently applied color theme. */
|
|
498
|
+
get colorTheme(): ITransformerColorTheme;
|
|
499
|
+
set colorTheme(value: ITransformerColorTheme);
|
|
500
|
+
/** The currently applied rotator anchor configuration. */
|
|
501
|
+
get rotatorAnchor(): IRotatorAnchorConfig;
|
|
502
|
+
set rotatorAnchor(value: IRotatorAnchorConfig);
|
|
503
|
+
/**
|
|
504
|
+
* Get the currently focused element within the group
|
|
505
|
+
*/
|
|
506
|
+
get focusedElement(): Container | null;
|
|
507
|
+
/**
|
|
508
|
+
* Set the focused element by index
|
|
509
|
+
*/
|
|
510
|
+
set focusedElementIndex(index: number);
|
|
511
|
+
get focusedElementIndex(): number;
|
|
512
|
+
/**
|
|
513
|
+
* Focus a specific element by reference
|
|
514
|
+
*/
|
|
515
|
+
focusElement(element: Container): void;
|
|
516
|
+
/**
|
|
517
|
+
* Clear element focus (show all individual borders)
|
|
518
|
+
*/
|
|
519
|
+
clearElementFocus(): void;
|
|
520
|
+
/**
|
|
521
|
+
* Cycle to next element in group
|
|
522
|
+
*/
|
|
523
|
+
focusNextElement(): void;
|
|
524
|
+
/**
|
|
525
|
+
* Update the element index map when group changes
|
|
526
|
+
*/
|
|
527
|
+
private updateElementIndexMap;
|
|
528
|
+
/**
|
|
529
|
+
* Set up or remove interaction for individual elements
|
|
530
|
+
*/
|
|
531
|
+
private setupElementInteraction;
|
|
532
|
+
/**
|
|
533
|
+
* Redraws all handles with updated styles
|
|
534
|
+
*/
|
|
535
|
+
private redrawAllHandles;
|
|
536
|
+
/**
|
|
537
|
+
* Draws a line for the rotator anchor, connecting the bounding box to the rotator handle
|
|
538
|
+
* @param x1 Start X coordinate (bounding box center)
|
|
539
|
+
* @param y1 Start Y coordinate (bounding box center)
|
|
540
|
+
* @param x2 End X coordinate (rotator handle position)
|
|
541
|
+
* @param y2 End Y coordinate (rotator handle position)
|
|
542
|
+
* @param lineWidth Width of the line
|
|
543
|
+
* @param color Color of the line
|
|
544
|
+
*/
|
|
545
|
+
private drawRotatorAnchorDot;
|
|
546
|
+
/**
|
|
547
|
+
* Draws a dashed line between two points using the configured dash pattern
|
|
548
|
+
*/
|
|
549
|
+
private drawDashedLine;
|
|
550
|
+
/**
|
|
551
|
+
* Draws a dotted line between two points using the configured dot pattern
|
|
552
|
+
*/
|
|
553
|
+
private drawDottedLine;
|
|
554
|
+
/**
|
|
555
|
+
* Draws a dashed rectangle around the given bounds
|
|
556
|
+
*/
|
|
557
|
+
private drawDashedBounds;
|
|
558
|
+
/**
|
|
559
|
+
* Draws a dotted rectangle around the given bounds
|
|
560
|
+
*/
|
|
561
|
+
private drawDottedBounds;
|
|
562
|
+
/**
|
|
563
|
+
* Draws a dashed line segment between two points
|
|
564
|
+
*/
|
|
565
|
+
private drawDashedLineSegment;
|
|
566
|
+
/**
|
|
567
|
+
* Draws a dotted line segment between two points
|
|
568
|
+
* Each dot is drawn as an independent shape to ensure proper rendering
|
|
569
|
+
*/
|
|
570
|
+
private drawDottedLineSegment;
|
|
571
|
+
/**
|
|
572
|
+
* @param forceUpdate - forces a recalculation of the group bounds
|
|
573
|
+
* @returns the oriented bounding box of the wireframe
|
|
574
|
+
*/
|
|
575
|
+
getGroupBounds(forceUpdate?: boolean): OrientedBounds;
|
|
576
|
+
/**
|
|
577
|
+
* This will translate the group by {@code delta} in their world-space.
|
|
578
|
+
*
|
|
579
|
+
* NOTE: There is no handle that provides translation. The user drags the transformer directly.
|
|
580
|
+
*
|
|
581
|
+
* @param delta
|
|
582
|
+
*/
|
|
583
|
+
translateGroup: (delta: Point) => void;
|
|
584
|
+
/**
|
|
585
|
+
* This will rotate the group such that the handle will come to {@code pointerPosition}.
|
|
586
|
+
*
|
|
587
|
+
* @param handle - the rotator handle was dragged
|
|
588
|
+
* @param pointerPosition - the new pointer position, in screen space
|
|
589
|
+
*/
|
|
590
|
+
rotateGroup: (handle: RotateHandle, pointerPosition: Point) => void;
|
|
591
|
+
/**
|
|
592
|
+
* This will scale the group such that the scale handle will come under {@code pointerPosition}.
|
|
593
|
+
*
|
|
594
|
+
* @param handle - the scaling handle that was dragged
|
|
595
|
+
* @param pointerPosition - the new pointer position, in screen space
|
|
596
|
+
*/
|
|
597
|
+
scaleGroup: (handle: ScaleHandle, pointerPosition: Point) => void;
|
|
598
|
+
/**
|
|
599
|
+
* This will skew the group such that the skew handle would move to the {@code pointerPosition}.
|
|
600
|
+
*
|
|
601
|
+
* @param handle
|
|
602
|
+
* @param pointerPosition - pointer position, in screen space
|
|
603
|
+
*/
|
|
604
|
+
skewGroup: (handle: SkewHandle, pointerPosition: Point) => void;
|
|
605
|
+
/**
|
|
606
|
+
* This is called after the user finishes dragging a handle. If {@link this.transientGroupTilt} is enabled, it will
|
|
607
|
+
* reset the rotation of this group (if more than one display-object is grouped).
|
|
608
|
+
*/
|
|
609
|
+
commitGroup: () => void;
|
|
610
|
+
/**
|
|
611
|
+
* Build the payload emitted by `transformcommit`. Reads dimensions from the
|
|
612
|
+
* current group state (post-mutation) — `position`, `scale`, `rotation`,
|
|
613
|
+
* `skew`, `pivot`, plus the v8 `width`/`height` displayed accessors.
|
|
614
|
+
*
|
|
615
|
+
* Centralised so listeners get a stable shape regardless of which `*Group`
|
|
616
|
+
* method drove the commit (translate / scale / rotate / skew).
|
|
617
|
+
*/
|
|
618
|
+
protected buildCommitPayload(handle: Handle | null, transformType: 'translate' | 'scale' | 'rotate' | 'skew' | 'none'): ITransformCommitPayload;
|
|
619
|
+
/** Recalculates the transformer's geometry. Called via the v8 `onRender` callback registered in the constructor. */
|
|
620
|
+
protected draw(): void;
|
|
621
|
+
/**
|
|
622
|
+
* Draw the handles and any remaining parts of the wireframe.
|
|
623
|
+
*
|
|
624
|
+
* @param groupBounds
|
|
625
|
+
*/
|
|
626
|
+
protected drawHandles(groupBounds: OrientedBounds): void;
|
|
627
|
+
/** Called on the `pointerdown` event. You must call the super implementation. */
|
|
628
|
+
protected onPointerDown(e: FederatedPointerEvent): void;
|
|
629
|
+
/**
|
|
630
|
+
* Determine if display-object a is above display-object b in render order.
|
|
631
|
+
* This walks up the scene graph to the first diverging ancestor and
|
|
632
|
+
* compares their child indices (assuming parent's children array is in render order).
|
|
633
|
+
*/
|
|
634
|
+
private static isAboveInDisplayOrder;
|
|
635
|
+
/** Called on the `pointermove` event. You must call the super implementation. */
|
|
636
|
+
protected onPointerMove(e: FederatedPointerEvent): void;
|
|
637
|
+
/**
|
|
638
|
+
* Emits the transformstart event once per interaction when a transformation begins.
|
|
639
|
+
*/
|
|
640
|
+
private emitTransformStart;
|
|
641
|
+
/** Called on the `pointerup` and `pointerupoutside` events. You must call the super implementation. */
|
|
642
|
+
protected onPointerUp(e: FederatedPointerEvent): void;
|
|
643
|
+
/**
|
|
644
|
+
* Applies the given transformation matrix {@code delta} to all the display-objects in the group.
|
|
645
|
+
*
|
|
646
|
+
* @param delta - transformation matrix
|
|
647
|
+
* @param skipUpdate - whether to skip updating the group-bounds after applying the transform
|
|
648
|
+
*/
|
|
649
|
+
protected prependTransform(delta: Matrix, skipUpdate?: boolean): void;
|
|
650
|
+
/**
|
|
651
|
+
* Recalculates {@code this.groupBounds} at the same angle.
|
|
652
|
+
*
|
|
653
|
+
* @param rotation - override the group's rotation
|
|
654
|
+
*/
|
|
655
|
+
private updateGroupBounds;
|
|
656
|
+
/**
|
|
657
|
+
* Snaps the given {@code angle} to one of the snapping angles, if possible.
|
|
658
|
+
*
|
|
659
|
+
* @param angle - the input angle
|
|
660
|
+
* @param snapTolerance - the maximum difference b/w the given angle & a snapping angle
|
|
661
|
+
* @param snaps - the snapping angles
|
|
662
|
+
* @returns the snapped angle
|
|
663
|
+
*/
|
|
664
|
+
private snapAngle;
|
|
665
|
+
/**
|
|
666
|
+
* Swap the handles represented by the two {@code TransformerHandle} instances.
|
|
667
|
+
*
|
|
668
|
+
* @param handle0
|
|
669
|
+
* @param handle1
|
|
670
|
+
*/
|
|
671
|
+
private swapHandles;
|
|
672
|
+
/** Set cursor from {@code this.cursors} based on the handle hovered currently. */
|
|
673
|
+
private setCursorFromHoveredHandle;
|
|
674
|
+
/**
|
|
675
|
+
* Projects {@code input} from the group's world space into the transformer's local space, and puts the result
|
|
676
|
+
* into {@code output}.
|
|
677
|
+
*
|
|
678
|
+
* @param input
|
|
679
|
+
* @param output
|
|
680
|
+
* @returns the output
|
|
681
|
+
*/
|
|
682
|
+
projectToLocal(input: Point, output?: Point): Point;
|
|
683
|
+
/**
|
|
684
|
+
* Calculates the positions of the four corners of the display-object. The quadrilateral formed by
|
|
685
|
+
* these points will be the tightest fit around it.
|
|
686
|
+
*
|
|
687
|
+
* @param displayObject - The display object whose corners are to be calculated
|
|
688
|
+
* @param transform - The transform applied on the display-object. By default, this is its world-transform
|
|
689
|
+
* @param corners - Optional array of four points to put the result into
|
|
690
|
+
* @param index - Optional index into "corners"
|
|
691
|
+
* @returns an array of four points holding the positions of the corners
|
|
692
|
+
*/
|
|
693
|
+
static calculateTransformedCorners(displayObject: Container, transform?: Matrix, corners?: Point[], index?: number): Point[];
|
|
694
|
+
/**
|
|
695
|
+
* Calculates the oriented bounding box of the display-object. This would not bending with any skew
|
|
696
|
+
* applied on the display-object, i.e. it is guaranteed to be rectangular.
|
|
697
|
+
*
|
|
698
|
+
* @param displayObject
|
|
699
|
+
* @param bounds - the bounds instance to set
|
|
700
|
+
*/
|
|
701
|
+
static calculateOrientedBounds(displayObject: Container, bounds?: OrientedBounds): OrientedBounds;
|
|
702
|
+
/**
|
|
703
|
+
* Calculates the oriented bounding box of a group of display-objects at a specific angle.
|
|
704
|
+
*
|
|
705
|
+
* @param group
|
|
706
|
+
* @param rotation
|
|
707
|
+
* @param bounds
|
|
708
|
+
* @param skipUpdate
|
|
709
|
+
*/
|
|
710
|
+
static calculateGroupOrientedBounds(group: Container[], rotation: number, bounds?: OrientedBounds, skipUpdate?: boolean): OrientedBounds;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Fired once when a transformation interaction begins (after the pointer moves beyond the click threshold).
|
|
714
|
+
*
|
|
715
|
+
* @event Transformer#transformstart
|
|
716
|
+
* @type {{ handle: Handle | null; transformType: "translate" | "scale" | "rotate" | "skew" | "none" }}
|
|
717
|
+
*/
|
|
718
|
+
/**
|
|
719
|
+
* This is fired when the transformer modifies the transforms of display-objects.
|
|
720
|
+
*
|
|
721
|
+
* @event Transformer#transformchange
|
|
722
|
+
* @type {Matrix}
|
|
723
|
+
*/
|
|
724
|
+
/**
|
|
725
|
+
* This is fired when the user lifts the mouse button after dragging a transformer handle. It can be used
|
|
726
|
+
*
|
|
727
|
+
* @event Transformer#transformcommit
|
|
728
|
+
*/
|