paper 0.16.0 → 1.0.0-rc.1
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/CHANGELOG.md +294 -0
- package/LICENSE.txt +1 -1
- package/MIGRATION.md +402 -0
- package/README.md +137 -143
- package/dist/esm/anim/Tween.js +404 -0
- package/dist/esm/basic/Line.js +252 -0
- package/dist/esm/basic/Matrix.js +603 -0
- package/dist/esm/basic/Point.js +738 -0
- package/dist/esm/basic/Rectangle.js +788 -0
- package/dist/esm/basic/Size.js +368 -0
- package/dist/esm/boolean/graph.js +950 -0
- package/dist/esm/boolean/index.js +143 -0
- package/dist/esm/boolean/operations.js +94 -0
- package/dist/esm/boolean/split.js +89 -0
- package/dist/esm/canvas/blendModes.js +115 -0
- package/dist/esm/canvas/canvasProvider.js +102 -0
- package/dist/esm/constants.js +130 -0
- package/dist/esm/core/Base.js +52 -0
- package/dist/esm/core/Emitter.js +215 -0
- package/dist/esm/core/features.js +53 -0
- package/dist/esm/core/serialization.js +174 -0
- package/dist/esm/core.js +15 -0
- package/dist/esm/dom/domElement.js +112 -0
- package/dist/esm/dom/domEvent.js +106 -0
- package/dist/esm/env.js +66 -0
- package/dist/esm/event/DrawEvent.js +38 -0
- package/dist/esm/event/Event.js +79 -0
- package/dist/esm/event/Key.js +236 -0
- package/dist/esm/event/KeyEvent.js +39 -0
- package/dist/esm/event/MouseEvent.js +91 -0
- package/dist/esm/hosted/HostItem.js +60 -0
- package/dist/esm/hosted/Hosting.js +1061 -0
- package/dist/esm/hosted/index.js +20 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/internal.js +115 -0
- package/dist/esm/item/Effect.js +256 -0
- package/dist/esm/item/EffectInstance.js +184 -0
- package/dist/esm/item/Group.js +293 -0
- package/dist/esm/item/HitResult.js +126 -0
- package/dist/esm/item/Item.js +3339 -0
- package/dist/esm/item/ItemDefinition.js +95 -0
- package/dist/esm/item/Layer.js +69 -0
- package/dist/esm/item/Project.js +1013 -0
- package/dist/esm/item/Raster.js +722 -0
- package/dist/esm/item/Shape.js +355 -0
- package/dist/esm/item/SymbolDefinition.js +68 -0
- package/dist/esm/item/SymbolItem.js +131 -0
- package/dist/esm/item/bounds.js +324 -0
- package/dist/esm/item/draw.js +525 -0
- package/dist/esm/item/effects.js +124 -0
- package/dist/esm/item/expand.js +87 -0
- package/dist/esm/item/hitTest.js +203 -0
- package/dist/esm/item/hosting.js +12 -0
- package/dist/esm/item/props.js +12 -0
- package/dist/esm/item/query.js +139 -0
- package/dist/esm/item/sampling.js +67 -0
- package/dist/esm/item/transform.js +128 -0
- package/dist/esm/net/http.js +26 -0
- package/dist/esm/node/CanvasAdapter.js +137 -0
- package/dist/esm/node/index.js +150 -0
- package/dist/esm/node/peers.js +27 -0
- package/dist/esm/offset/curves.js +866 -0
- package/dist/esm/offset/index.js +70 -0
- package/dist/esm/offset/offset.js +178 -0
- package/dist/esm/offset/outline.js +91 -0
- package/dist/esm/offset/pen.js +298 -0
- package/dist/esm/offset/profile.js +772 -0
- package/dist/esm/offset/round.js +213 -0
- package/dist/esm/offset/sweep.js +100 -0
- package/dist/esm/paperscript/PaperScript.js +832 -0
- package/dist/esm/paperscript/autoload.js +27 -0
- package/dist/esm/paperscript/index.js +17 -0
- package/dist/esm/path/CompoundPath.js +367 -0
- package/dist/esm/path/Curve.js +996 -0
- package/dist/esm/path/CurveLocation.js +462 -0
- package/dist/esm/path/Path.js +1761 -0
- package/dist/esm/path/PathFlattener.js +186 -0
- package/dist/esm/path/PathItem.js +757 -0
- package/dist/esm/path/Segment.js +640 -0
- package/dist/esm/path/SegmentPoint.js +106 -0
- package/dist/esm/path/StrokeProfile.js +387 -0
- package/dist/esm/path/StrokeProfileStop.js +207 -0
- package/dist/esm/path/boolean.js +284 -0
- package/dist/esm/path/bounds.js +257 -0
- package/dist/esm/path/crossing.js +114 -0
- package/dist/esm/path/draw.js +161 -0
- package/dist/esm/path/hitTest.js +259 -0
- package/dist/esm/path/offset.js +152 -0
- package/dist/esm/path/shapes.js +231 -0
- package/dist/esm/path/smooth.js +84 -0
- package/dist/esm/path/values.js +40 -0
- package/dist/esm/scope/PaperScope.js +288 -0
- package/dist/esm/scope/PaperScopeItem.js +74 -0
- package/dist/esm/smoothing/index.js +71 -0
- package/dist/esm/style/Color.js +917 -0
- package/dist/esm/style/Gradient.js +191 -0
- package/dist/esm/style/GradientStop.js +168 -0
- package/dist/esm/style/PatternDefinition.js +383 -0
- package/dist/esm/style/Style.js +503 -0
- package/dist/esm/svg/index.js +27 -0
- package/dist/esm/svg/svgElement.js +97 -0
- package/dist/esm/svg/svgExport.js +847 -0
- package/dist/esm/svg/svgImport.js +1101 -0
- package/dist/esm/svg/svgStyles.js +96 -0
- package/dist/esm/text/AreaText.js +190 -0
- package/dist/esm/text/PathText.js +111 -0
- package/dist/esm/text/PointText.js +92 -0
- package/dist/esm/text/TextItem.js +538 -0
- package/dist/esm/text/TextRange.js +169 -0
- package/dist/esm/text/TextStory.js +394 -0
- package/dist/esm/text/areaLayout.js +439 -0
- package/dist/esm/text/layout.js +265 -0
- package/dist/esm/text/measure.js +57 -0
- package/dist/esm/text/pathLayout.js +93 -0
- package/dist/esm/tool/Tool.js +284 -0
- package/dist/esm/tool/ToolEvent.js +232 -0
- package/dist/esm/util/Formatter.js +57 -0
- package/dist/esm/util/collisions.js +216 -0
- package/dist/esm/util/list.js +110 -0
- package/dist/esm/util/numerical.js +656 -0
- package/dist/esm/util/object.js +81 -0
- package/dist/esm/util/string.js +29 -0
- package/dist/esm/util/uid.js +31 -0
- package/dist/esm/values/arcs.js +243 -0
- package/dist/esm/values/curve.js +975 -0
- package/dist/esm/values/fit.js +290 -0
- package/dist/esm/values/index.js +23 -0
- package/dist/esm/values/intersections.js +869 -0
- package/dist/esm/values/matrix.js +114 -0
- package/dist/esm/values/path.js +174 -0
- package/dist/esm/values/profile.js +221 -0
- package/dist/esm/values/region.js +63 -0
- package/dist/esm/values/smooth.js +248 -0
- package/dist/esm/values/svg.js +287 -0
- package/dist/esm/view/CanvasView.js +106 -0
- package/dist/esm/view/View.js +775 -0
- package/dist/esm/view/input.js +527 -0
- package/dist/paper-full.js +33083 -22681
- package/dist/paper-full.min.js +36 -31
- package/dist/paper-hosted.js +33898 -23223
- package/dist/paper-hosted.min.js +37 -0
- package/dist/paper-slim.js +28581 -0
- package/dist/paper-slim.min.js +17 -0
- package/dist/types/anim/Tween.d.ts +164 -0
- package/dist/types/basic/Line.d.ts +136 -0
- package/dist/types/basic/Matrix.d.ts +387 -0
- package/dist/types/basic/Point.d.ts +781 -0
- package/dist/types/basic/Rectangle.d.ts +550 -0
- package/dist/types/basic/Size.d.ts +457 -0
- package/dist/types/boolean/graph.d.ts +123 -0
- package/dist/types/boolean/index.d.ts +74 -0
- package/dist/types/boolean/operations.d.ts +9 -0
- package/dist/types/boolean/split.d.ts +19 -0
- package/dist/types/canvas/blendModes.d.ts +18 -0
- package/dist/types/canvas/canvasProvider.d.ts +32 -0
- package/dist/types/constants.d.ts +112 -0
- package/dist/types/core/Base.d.ts +50 -0
- package/dist/types/core/Emitter.d.ts +49 -0
- package/dist/types/core/features.d.ts +41 -0
- package/dist/types/core/serialization.d.ts +44 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/dom/domElement.d.ts +33 -0
- package/dist/types/dom/domEvent.d.ts +29 -0
- package/dist/types/env.d.ts +26 -0
- package/dist/types/event/DrawEvent.d.ts +27 -0
- package/dist/types/event/Event.d.ts +47 -0
- package/dist/types/event/Key.d.ts +82 -0
- package/dist/types/event/KeyEvent.d.ts +35 -0
- package/dist/types/event/MouseEvent.d.ts +78 -0
- package/dist/types/hosted/HostItem.d.ts +26 -0
- package/dist/types/hosted/Hosting.d.ts +273 -0
- package/dist/types/hosted/index.d.ts +10 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/internal.d.ts +101 -0
- package/dist/types/item/Effect.d.ts +128 -0
- package/dist/types/item/EffectInstance.d.ts +81 -0
- package/dist/types/item/Group.d.ts +225 -0
- package/dist/types/item/HitResult.d.ts +94 -0
- package/dist/types/item/Item.d.ts +2927 -0
- package/dist/types/item/ItemDefinition.d.ts +25 -0
- package/dist/types/item/Layer.d.ts +80 -0
- package/dist/types/item/Project.d.ts +748 -0
- package/dist/types/item/Raster.d.ts +431 -0
- package/dist/types/item/Shape.d.ts +219 -0
- package/dist/types/item/SymbolDefinition.d.ts +98 -0
- package/dist/types/item/SymbolItem.d.ts +92 -0
- package/dist/types/item/bounds.d.ts +56 -0
- package/dist/types/item/draw.d.ts +23 -0
- package/dist/types/item/effects.d.ts +22 -0
- package/dist/types/item/expand.d.ts +7 -0
- package/dist/types/item/hitTest.d.ts +10 -0
- package/dist/types/item/hosting.d.ts +20 -0
- package/dist/types/item/props.d.ts +35 -0
- package/dist/types/item/query.d.ts +14 -0
- package/dist/types/item/sampling.d.ts +5 -0
- package/dist/types/item/transform.d.ts +3 -0
- package/dist/types/net/http.d.ts +6 -0
- package/dist/types/node/CanvasAdapter.d.ts +19 -0
- package/dist/types/node/index.d.ts +60 -0
- package/dist/types/node/peers.d.ts +2 -0
- package/dist/types/offset/curves.d.ts +22 -0
- package/dist/types/offset/index.d.ts +65 -0
- package/dist/types/offset/offset.d.ts +18 -0
- package/dist/types/offset/outline.d.ts +14 -0
- package/dist/types/offset/pen.d.ts +36 -0
- package/dist/types/offset/profile.d.ts +37 -0
- package/dist/types/offset/round.d.ts +18 -0
- package/dist/types/offset/sweep.d.ts +44 -0
- package/dist/types/paperscript/PaperScript.d.ts +114 -0
- package/dist/types/paperscript/autoload.d.ts +1 -0
- package/dist/types/paperscript/index.d.ts +7 -0
- package/dist/types/path/CompoundPath.d.ts +183 -0
- package/dist/types/path/Curve.d.ts +567 -0
- package/dist/types/path/CurveLocation.d.ts +164 -0
- package/dist/types/path/Path.d.ts +1361 -0
- package/dist/types/path/PathFlattener.d.ts +48 -0
- package/dist/types/path/PathItem.d.ts +1190 -0
- package/dist/types/path/Segment.d.ts +335 -0
- package/dist/types/path/SegmentPoint.d.ts +1 -0
- package/dist/types/path/StrokeProfile.d.ts +74 -0
- package/dist/types/path/StrokeProfileStop.d.ts +110 -0
- package/dist/types/path/boolean.d.ts +24 -0
- package/dist/types/path/bounds.d.ts +24 -0
- package/dist/types/path/crossing.d.ts +2 -0
- package/dist/types/path/draw.d.ts +6 -0
- package/dist/types/path/hitTest.d.ts +8 -0
- package/dist/types/path/offset.d.ts +14 -0
- package/dist/types/path/shapes.d.ts +20 -0
- package/dist/types/path/smooth.d.ts +18 -0
- package/dist/types/path/values.d.ts +8 -0
- package/dist/types/scope/PaperScope.d.ts +182 -0
- package/dist/types/scope/PaperScopeItem.d.ts +26 -0
- package/dist/types/smoothing/index.d.ts +26 -0
- package/dist/types/style/Color.d.ts +829 -0
- package/dist/types/style/Gradient.d.ts +130 -0
- package/dist/types/style/GradientStop.d.ts +126 -0
- package/dist/types/style/PatternDefinition.d.ts +185 -0
- package/dist/types/style/Style.d.ts +757 -0
- package/dist/types/svg/index.d.ts +14 -0
- package/dist/types/svg/svgElement.d.ts +32 -0
- package/dist/types/svg/svgExport.d.ts +19 -0
- package/dist/types/svg/svgImport.d.ts +13 -0
- package/dist/types/svg/svgStyles.d.ts +20 -0
- package/dist/types/text/AreaText.d.ts +104 -0
- package/dist/types/text/PathText.d.ts +78 -0
- package/dist/types/text/PointText.d.ts +50 -0
- package/dist/types/text/TextItem.d.ts +163 -0
- package/dist/types/text/TextRange.d.ts +98 -0
- package/dist/types/text/TextStory.d.ts +119 -0
- package/dist/types/text/areaLayout.d.ts +3 -0
- package/dist/types/text/layout.d.ts +43 -0
- package/dist/types/text/measure.d.ts +7 -0
- package/dist/types/text/pathLayout.d.ts +3 -0
- package/dist/types/tool/Tool.d.ts +356 -0
- package/dist/types/tool/ToolEvent.d.ts +134 -0
- package/dist/types/util/Formatter.d.ts +34 -0
- package/dist/types/util/collisions.d.ts +77 -0
- package/dist/types/util/list.d.ts +23 -0
- package/dist/types/util/numerical.d.ts +196 -0
- package/dist/types/util/object.d.ts +19 -0
- package/dist/types/util/string.d.ts +12 -0
- package/dist/types/util/uid.d.ts +7 -0
- package/dist/types/values/arcs.d.ts +10 -0
- package/dist/types/values/curve.d.ts +42 -0
- package/dist/types/values/fit.d.ts +26 -0
- package/dist/types/values/index.d.ts +10 -0
- package/dist/types/values/intersections.d.ts +11 -0
- package/dist/types/values/matrix.d.ts +19 -0
- package/dist/types/values/path.d.ts +26 -0
- package/dist/types/values/profile.d.ts +41 -0
- package/dist/types/values/region.d.ts +13 -0
- package/dist/types/values/smooth.d.ts +39 -0
- package/dist/types/values/svg.d.ts +47 -0
- package/dist/types/view/CanvasView.d.ts +37 -0
- package/dist/types/view/View.d.ts +700 -0
- package/dist/types/view/input.d.ts +28 -0
- package/package.json +90 -58
- package/dist/docs/assets/css/docs.css +0 -414
- package/dist/docs/assets/js/codemirror.js +0 -4
- package/dist/docs/assets/js/docs.js +0 -493
- package/dist/docs/assets/js/jquery.js +0 -6
- package/dist/docs/assets/js/paper.js +0 -23759
- package/dist/docs/classes/AreaText.html +0 -8708
- package/dist/docs/classes/ChangeFlag.html +0 -385
- package/dist/docs/classes/Color.html +0 -2205
- package/dist/docs/classes/CompoundPath.html +0 -9168
- package/dist/docs/classes/Curve.html +0 -2326
- package/dist/docs/classes/CurveLocation.html +0 -673
- package/dist/docs/classes/Event.html +0 -177
- package/dist/docs/classes/Gradient.html +0 -241
- package/dist/docs/classes/GradientStop.html +0 -274
- package/dist/docs/classes/Group.html +0 -7139
- package/dist/docs/classes/HitResult.html +0 -241
- package/dist/docs/classes/HostItem.html +0 -6836
- package/dist/docs/classes/Item.html +0 -6892
- package/dist/docs/classes/Key.html +0 -140
- package/dist/docs/classes/KeyEvent.html +0 -309
- package/dist/docs/classes/Layer.html +0 -7122
- package/dist/docs/classes/Matrix.html +0 -1745
- package/dist/docs/classes/MouseEvent.html +0 -356
- package/dist/docs/classes/PaperScope.html +0 -548
- package/dist/docs/classes/PaperScript.html +0 -202
- package/dist/docs/classes/Path.html +0 -12064
- package/dist/docs/classes/PathItem.html +0 -8930
- package/dist/docs/classes/PathText.html +0 -8578
- package/dist/docs/classes/Point.html +0 -2860
- package/dist/docs/classes/PointText.html +0 -8489
- package/dist/docs/classes/Project.html +0 -1604
- package/dist/docs/classes/Raster.html +0 -8069
- package/dist/docs/classes/Rectangle.html +0 -1698
- package/dist/docs/classes/Segment.html +0 -1017
- package/dist/docs/classes/Shape.html +0 -7570
- package/dist/docs/classes/Size.html +0 -1915
- package/dist/docs/classes/Style.html +0 -1765
- package/dist/docs/classes/SymbolDefinition.html +0 -312
- package/dist/docs/classes/SymbolItem.html +0 -6999
- package/dist/docs/classes/TextItem.html +0 -8332
- package/dist/docs/classes/TextRange.html +0 -186
- package/dist/docs/classes/TextStory.html +0 -355
- package/dist/docs/classes/Tool.html +0 -888
- package/dist/docs/classes/ToolEvent.html +0 -525
- package/dist/docs/classes/Tween.html +0 -390
- package/dist/docs/classes/View.html +0 -2108
- package/dist/docs/classes/global.html +0 -426
- package/dist/docs/classes/index.html +0 -88
- package/dist/docs/index.html +0 -11
- package/dist/node/canvas.js +0 -68
- package/dist/node/extend.js +0 -156
- package/dist/node/self.js +0 -67
- package/dist/paper-core.d.ts +0 -1
- package/dist/paper-core.js +0 -21834
- package/dist/paper-core.min.js +0 -32
- package/dist/paper.d.ts +0 -9630
- package/examples/Animated/AnimatedStar.html +0 -53
- package/examples/Animated/BooleanOperations.html +0 -115
- package/examples/Animated/CandyCrash.html +0 -151
- package/examples/Animated/Extruded.html +0 -50
- package/examples/Animated/Lines.html +0 -53
- package/examples/Animated/Smoothing.html +0 -70
- package/examples/Animated/Space.html +0 -86
- package/examples/Animated/SpaceUsingShapes.html +0 -79
- package/examples/Games/Paperoids.html +0 -569
- package/examples/JSON/Circle Testing.html +0 -34
- package/examples/JSON/Compound Path.html +0 -25
- package/examples/JSON/Empty Path Testing.html +0 -31
- package/examples/JSON/Gradients.html +0 -34
- package/examples/JSON/Group Transform.html +0 -28
- package/examples/JSON/Line Testing.html +0 -44
- package/examples/JSON/Random Path Testing.html +0 -42
- package/examples/JSON/Raster.html +0 -29
- package/examples/JSON/Rect and Attribute Testing.html +0 -56
- package/examples/JSON/Rotated Primitives.html +0 -55
- package/examples/JSON/Selection.html +0 -43
- package/examples/JSON/Shapes.html +0 -54
- package/examples/JSON/Symbols.html +0 -30
- package/examples/JSON/Text Testing.html +0 -38
- package/examples/JSON/Tiger.html +0 -19
- package/examples/JSON/Transform Test 1.html +0 -32
- package/examples/JSON/Transform Test 2.html +0 -30
- package/examples/Node.js/AnimatedStar.js +0 -52
- package/examples/Node.js/BooleanOperations.js +0 -36
- package/examples/Node.js/JSONtoPDF.js +0 -20
- package/examples/Node.js/Raster.js +0 -32
- package/examples/Node.js/RasterRemote.js +0 -33
- package/examples/Node.js/SvgExport.js +0 -52
- package/examples/Node.js/SvgImport.js +0 -23
- package/examples/Node.js/Tadpoles.js +0 -16
- package/examples/Node.js/Tadpoles.pjs +0 -278
- package/examples/Node.js/in.json +0 -1
- package/examples/Node.js/in.svg +0 -16
- package/examples/Paperjs.org/BooleanOperattions.html +0 -115
- package/examples/Paperjs.org/BouncingBalls.html +0 -103
- package/examples/Paperjs.org/Chain.html +0 -54
- package/examples/Paperjs.org/DivisionRaster.html +0 -72
- package/examples/Paperjs.org/FutureSplash.html +0 -122
- package/examples/Paperjs.org/HitTesting.html +0 -103
- package/examples/Paperjs.org/InteractiveTiger.html +0 -777
- package/examples/Paperjs.org/MetaBalls.html +0 -132
- package/examples/Paperjs.org/NyanRainbow.html +0 -202
- package/examples/Paperjs.org/PathIntersections.html +0 -76
- package/examples/Paperjs.org/Qbertify.html +0 -146
- package/examples/Paperjs.org/RadialRainbows.html +0 -80
- package/examples/Paperjs.org/RoundedRectangles.html +0 -41
- package/examples/Paperjs.org/SatieLikedToDraw.html +0 -140
- package/examples/Paperjs.org/Simplify.html +0 -63
- package/examples/Paperjs.org/SpiralRaster.html +0 -120
- package/examples/Paperjs.org/Tadpoles.html +0 -283
- package/examples/Paperjs.org/Voronoi.html +0 -134
- package/examples/Rasters/PhyllotaxisRaster.html +0 -96
- package/examples/Rasters/Raster.html +0 -34
- package/examples/Rasters/RotationRaster.html +0 -44
- package/examples/Rasters/Smoothing.html +0 -36
- package/examples/SVG Export/Circle Testing.html +0 -32
- package/examples/SVG Export/Clipping.html +0 -17
- package/examples/SVG Export/Compound Path.html +0 -22
- package/examples/SVG Export/Empty Path Testing.html +0 -28
- package/examples/SVG Export/Gradients.html +0 -52
- package/examples/SVG Export/Group Transform.html +0 -25
- package/examples/SVG Export/Line Testing.html +0 -41
- package/examples/SVG Export/Random Path Testing.html +0 -39
- package/examples/SVG Export/Raster.html +0 -21
- package/examples/SVG Export/Rect and Attribute Testing.html +0 -53
- package/examples/SVG Export/Rotated Primitives.html +0 -80
- package/examples/SVG Export/Shapes.html +0 -58
- package/examples/SVG Export/Symbols.html +0 -27
- package/examples/SVG Export/Text Testing.html +0 -45
- package/examples/SVG Export/Tiger.html +0 -23
- package/examples/SVG Export/Transform Test 1.html +0 -29
- package/examples/SVG Export/Transform Test 2.html +0 -27
- package/examples/SVG Import/Arcs.html +0 -78
- package/examples/SVG Import/Butterfly.html +0 -223
- package/examples/SVG Import/Circle and Ellipse Testing.html +0 -26
- package/examples/SVG Import/Clipping.html +0 -100
- package/examples/SVG Import/From File.html +0 -30
- package/examples/SVG Import/Gradient.html +0 -138
- package/examples/SVG Import/Gradients.html +0 -30
- package/examples/SVG Import/Inkscape Pivot.html +0 -52
- package/examples/SVG Import/Inkscape.html +0 -88
- package/examples/SVG Import/Line Testing.html +0 -24
- package/examples/SVG Import/MoreGradients.html +0 -107
- package/examples/SVG Import/Multiple Paths Test 1.html +0 -42
- package/examples/SVG Import/Multiple Paths Test 2.html +0 -33
- package/examples/SVG Import/Nested Groups Test.html +0 -78
- package/examples/SVG Import/Polybezier.html +0 -43
- package/examples/SVG Import/Rect Testing.html +0 -25
- package/examples/SVG Import/Symbols.html +0 -24
- package/examples/SVG Import/Testing.html +0 -40
- package/examples/SVG Import/Text Testing.html +0 -19
- package/examples/SVG Import/Tiger.html +0 -742
- package/examples/SVG Import/Transform Testing.html +0 -22
- package/examples/SVG Import/Viewbox.html +0 -38
- package/examples/Scripts/Arcs.html +0 -39
- package/examples/Scripts/AreaText.html +0 -65
- package/examples/Scripts/BlendModes.html +0 -77
- package/examples/Scripts/BooleanOperations.html +0 -937
- package/examples/Scripts/CompoundPath.html +0 -19
- package/examples/Scripts/CurveTimeParameterization.html +0 -61
- package/examples/Scripts/HslColor.html +0 -53
- package/examples/Scripts/PathStructure.html +0 -82
- package/examples/Scripts/PathTangents.html +0 -73
- package/examples/Scripts/PathText.html +0 -48
- package/examples/Scripts/Resize.html +0 -42
- package/examples/Scripts/RoundRectangle.html +0 -28
- package/examples/Scripts/Shapes.html +0 -54
- package/examples/Scripts/StrokeBounds.html +0 -101
- package/examples/Scripts/StrokeScaling.html +0 -65
- package/examples/Scripts/TextRanges.html +0 -51
- package/examples/Tools/BezierTool.html +0 -90
- package/examples/Tools/Circles.html +0 -28
- package/examples/Tools/Clouds.html +0 -35
- package/examples/Tools/DrippingBrush.html +0 -73
- package/examples/Tools/FancyBrush.html +0 -82
- package/examples/Tools/Grid.html +0 -44
- package/examples/Tools/MultiLines.html +0 -44
- package/examples/Tools/MultipleTools.html +0 -44
- package/examples/Tools/PathEditing.html +0 -95
- package/examples/Tools/SquareRounded.html +0 -76
- package/examples/Tools/Stars.html +0 -38
- package/examples/Tools/Vektor.html +0 -200
- package/examples/Tools/Wave.html +0 -50
- package/examples/Tools/WormFarm.html +0 -88
- package/examples/Worker/Main.html +0 -53
- package/examples/Worker/Worker.js +0 -14
- package/examples/css/style.css +0 -12
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Base, EffectInstance } from '../internal.ts';
|
|
2
|
+
import type { Item } from './Item.ts';
|
|
3
|
+
type EffectParameter = Record<string, unknown>;
|
|
4
|
+
type EffectEvent = {
|
|
5
|
+
art: Item;
|
|
6
|
+
item: Item;
|
|
7
|
+
};
|
|
8
|
+
type EffectProps = {
|
|
9
|
+
type: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
parameters?: Record<string, EffectParameter>;
|
|
12
|
+
interactive?: boolean;
|
|
13
|
+
onApply?: (this: EffectInstance | Effect, event: EffectEvent) => Item | void;
|
|
14
|
+
onEditParameters?: (this: EffectInstance) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A live effect, which derives what is drawn from an item without changing
|
|
18
|
+
* the item itself, as the effects in Illustrator do. Creating one registers it
|
|
19
|
+
* under its type, replacing any effect registered there before, and items use
|
|
20
|
+
* it by that type, see {@link Item#effects}, each through an
|
|
21
|
+
* {@link EffectInstance} with its own parameters. Hosts read from
|
|
22
|
+
* {@link #interactive} whether to draw it during interactions too.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* new Effect({
|
|
26
|
+
* type: 'shrink',
|
|
27
|
+
* label: 'Shrink',
|
|
28
|
+
* parameters: {
|
|
29
|
+
* amount: { label: 'Amount', type: 'number', value: 0.5 }
|
|
30
|
+
* },
|
|
31
|
+
* onApply: function(event) {
|
|
32
|
+
* return event.art.scale(this.amount);
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
* path.addEffect({ type: 'shrink', parameters: { amount: 0.8 } });
|
|
36
|
+
*/
|
|
37
|
+
export declare class Effect extends Base {
|
|
38
|
+
#private;
|
|
39
|
+
static _version: number;
|
|
40
|
+
_defaults: Record<string, unknown>;
|
|
41
|
+
_accessors: PropertyDescriptorMap;
|
|
42
|
+
/**
|
|
43
|
+
* The function that applies the effect, called with the instance as
|
|
44
|
+
* `this`, and returning what the effect makes of the art that it gets,
|
|
45
|
+
* which it doesn't change. The function receives an event object with
|
|
46
|
+
* these fields:
|
|
47
|
+
*
|
|
48
|
+
* @option event.art {Item} the item to apply the effect to, or what the
|
|
49
|
+
* effect before it returned
|
|
50
|
+
* @option event.item {Item} the item that the instance is part of
|
|
51
|
+
*/
|
|
52
|
+
onApply: EffectProps['onApply'] | null;
|
|
53
|
+
/**
|
|
54
|
+
* The function that hosts call when the user edits the parameters of an
|
|
55
|
+
* instance, with the instance as `this`, to set its properties. Paper.js
|
|
56
|
+
* itself doesn't call it.
|
|
57
|
+
*/
|
|
58
|
+
onEditParameters: EffectProps['onEditParameters'] | null;
|
|
59
|
+
/**
|
|
60
|
+
* Creates an effect and registers it under its type.
|
|
61
|
+
*
|
|
62
|
+
* @param props the {@link #type} of the effect, its {@link #label},
|
|
63
|
+
* {@link #parameters} and {@link #interactive}, and {@link #onApply}
|
|
64
|
+
* and {@link #onEditParameters}
|
|
65
|
+
*/
|
|
66
|
+
constructor(props: EffectProps);
|
|
67
|
+
/**
|
|
68
|
+
* The type that the effect is registered under, and that items use it by.
|
|
69
|
+
*/
|
|
70
|
+
get type(): string;
|
|
71
|
+
/**
|
|
72
|
+
* The label of the effect, for hosts to show to users.
|
|
73
|
+
*
|
|
74
|
+
* @default the type
|
|
75
|
+
*/
|
|
76
|
+
get label(): string;
|
|
77
|
+
/**
|
|
78
|
+
* The declared parameters of the effect by their names, as objects that
|
|
79
|
+
* describe them for hosts to build their settings from, with the default
|
|
80
|
+
* as their `value`, e.g.
|
|
81
|
+
* `{ label: 'Amount', type: 'number', range: [0, 100], value: 10 }`.
|
|
82
|
+
* The instances of the effect have them as properties.
|
|
83
|
+
*/
|
|
84
|
+
get parameters(): Record<string, EffectParameter>;
|
|
85
|
+
/**
|
|
86
|
+
* Specifies whether the effect is quick enough for hosts to draw it during
|
|
87
|
+
* interactions, while the user drags or edits an item with the host's own
|
|
88
|
+
* tools, and not only once they end. Paper.js itself doesn't read it.
|
|
89
|
+
*
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
get interactive(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Removes the effect from the registered effects.
|
|
95
|
+
*
|
|
96
|
+
* @return {@true if the effect was registered}
|
|
97
|
+
*/
|
|
98
|
+
remove(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Registers the effect under its type, replacing any effect registered
|
|
101
|
+
* there before. Effects register themselves when they are created.
|
|
102
|
+
*
|
|
103
|
+
* @param effect the effect to register
|
|
104
|
+
* @return the effect
|
|
105
|
+
*/
|
|
106
|
+
static add(effect: Effect): Effect;
|
|
107
|
+
/**
|
|
108
|
+
* Returns the effect registered under the type.
|
|
109
|
+
*
|
|
110
|
+
* @param type the type of the effect
|
|
111
|
+
* @return the effect, or `null`
|
|
112
|
+
*/
|
|
113
|
+
static get(type: string): Effect | null;
|
|
114
|
+
/**
|
|
115
|
+
* Returns all registered effects.
|
|
116
|
+
*
|
|
117
|
+
* @return the effects
|
|
118
|
+
*/
|
|
119
|
+
static getAll(): Effect[];
|
|
120
|
+
/**
|
|
121
|
+
* Removes the effect from the registered effects.
|
|
122
|
+
*
|
|
123
|
+
* @param effect the effect to remove
|
|
124
|
+
* @return {@true if the effect was registered}
|
|
125
|
+
*/
|
|
126
|
+
static remove(effect: Effect): boolean;
|
|
127
|
+
}
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Base, Effect } from '../internal.ts';
|
|
2
|
+
import type { Item } from './Item.ts';
|
|
3
|
+
import type { JSONDictionary, JSONOptions } from '../core/serialization.ts';
|
|
4
|
+
type EffectInstanceProps = {
|
|
5
|
+
type: string;
|
|
6
|
+
parameters?: Record<string, unknown>;
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The use of an {@link Effect} on an item, see {@link Item#effects}, with its
|
|
11
|
+
* parameters. The parameters that the effect declares are also its
|
|
12
|
+
* properties. Instances of effects that aren't registered keep their
|
|
13
|
+
* parameters and leave what they get as it is, so that they still round-trip.
|
|
14
|
+
*/
|
|
15
|
+
export declare class EffectInstance extends Base {
|
|
16
|
+
#private;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
_visible: boolean;
|
|
19
|
+
_item: Item | null;
|
|
20
|
+
_index: number | null;
|
|
21
|
+
_parameters: Record<string, unknown>;
|
|
22
|
+
constructor(props: EffectInstanceProps);
|
|
23
|
+
_getProps(): EffectInstanceProps;
|
|
24
|
+
_serialize(options: JSONOptions, dictionary: JSONDictionary): any;
|
|
25
|
+
_changed(): void;
|
|
26
|
+
/**
|
|
27
|
+
* The type of the effect that the instance uses, also when it isn't
|
|
28
|
+
* registered.
|
|
29
|
+
*/
|
|
30
|
+
get type(): string;
|
|
31
|
+
/**
|
|
32
|
+
* The effect that the instance uses, registered under its {@link #type},
|
|
33
|
+
* or `null` if there is none.
|
|
34
|
+
*/
|
|
35
|
+
get effect(): Effect | null;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the effect applies. Effects that aren't visible are skipped.
|
|
38
|
+
*
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
get visible(): boolean;
|
|
42
|
+
set visible(visible: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* The parameters of the instance. Changing them on the returned object
|
|
45
|
+
* updates it, as setting them as its properties does. Parameters that it
|
|
46
|
+
* doesn't have yet are added by setting them all, as are changes within
|
|
47
|
+
* values such as arrays.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* var instance = path.addEffect({
|
|
51
|
+
* type: 'offset',
|
|
52
|
+
* parameters: { distance: 10 }
|
|
53
|
+
* });
|
|
54
|
+
* instance.parameters.distance = 20; // Redraws.
|
|
55
|
+
* instance.parameters = { distance: 5, join: 'round' };
|
|
56
|
+
*/
|
|
57
|
+
get parameters(): Record<string, unknown>;
|
|
58
|
+
set parameters(parameters: Record<string, unknown>);
|
|
59
|
+
/**
|
|
60
|
+
* The item that the instance is part of.
|
|
61
|
+
*/
|
|
62
|
+
get item(): Item | null;
|
|
63
|
+
/**
|
|
64
|
+
* The index of the instance in the {@link Item#effects} of its item.
|
|
65
|
+
*/
|
|
66
|
+
get index(): number | null;
|
|
67
|
+
/**
|
|
68
|
+
* Removes the instance from its item.
|
|
69
|
+
*
|
|
70
|
+
* @return {@true if the instance was removed}
|
|
71
|
+
*/
|
|
72
|
+
remove(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Checks whether the instance is equal to the supplied one.
|
|
75
|
+
*
|
|
76
|
+
* @param instance the instance to compare with
|
|
77
|
+
* @return {@true if they are equal}
|
|
78
|
+
*/
|
|
79
|
+
equals(instance: EffectInstance): boolean;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { Item } from '../internal.ts';
|
|
2
|
+
import type { ItemProps } from './props.ts';
|
|
3
|
+
import type { Point } from '../basic/Point.ts';
|
|
4
|
+
import type { Matrix } from '../basic/Matrix.ts';
|
|
5
|
+
import type { Rectangle } from '../basic/Rectangle.ts';
|
|
6
|
+
import type { Style, TextStyleProperties } from '../style/Style.ts';
|
|
7
|
+
import type { HitResult } from './HitResult.ts';
|
|
8
|
+
import type { DrawParam } from './draw.ts';
|
|
9
|
+
import type { BoundsOptions } from './Item.ts';
|
|
10
|
+
import type { HitTestOptions } from './HitResult.ts';
|
|
11
|
+
import type { JSONDictionary, JSONOptions } from '../core/serialization.ts';
|
|
12
|
+
/**
|
|
13
|
+
* A Group is a collection of items. When you transform a Group, its children
|
|
14
|
+
* are treated as a single unit without changing their relative positions.
|
|
15
|
+
*/
|
|
16
|
+
export declare class Group extends Item {
|
|
17
|
+
_isolated: boolean;
|
|
18
|
+
_buffered: boolean;
|
|
19
|
+
_clipItem: Item | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new Group item and places it at the top of the active layer.
|
|
22
|
+
*
|
|
23
|
+
* @param children an array of children that will be added to the newly
|
|
24
|
+
* created group
|
|
25
|
+
*
|
|
26
|
+
* @example {@paperscript}
|
|
27
|
+
* // Create a group containing two paths:
|
|
28
|
+
* var path = new Path([100, 100], [100, 200]);
|
|
29
|
+
* var path2 = new Path([50, 150], [150, 150]);
|
|
30
|
+
*
|
|
31
|
+
* // Create a group from the two paths:
|
|
32
|
+
* var group = new Group([path, path2]);
|
|
33
|
+
*
|
|
34
|
+
* // Set the stroke color of all items in the group:
|
|
35
|
+
* group.strokeColor = 'black';
|
|
36
|
+
*
|
|
37
|
+
* // Move the group to the center of the view:
|
|
38
|
+
* group.position = view.center;
|
|
39
|
+
*
|
|
40
|
+
* @example {@paperscript height=320}
|
|
41
|
+
* // Click in the view to add a path to the group, which in turn is rotated
|
|
42
|
+
* // every frame:
|
|
43
|
+
* var group = new Group();
|
|
44
|
+
*
|
|
45
|
+
* function onMouseDown(event) {
|
|
46
|
+
* // Create a new circle shaped path at the position
|
|
47
|
+
* // of the mouse:
|
|
48
|
+
* var path = Path.circle(event.point, 5);
|
|
49
|
+
* path.fillColor = 'black';
|
|
50
|
+
*
|
|
51
|
+
* // Add the path to the group's children list:
|
|
52
|
+
* group.addChild(path);
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* function onFrame(event) {
|
|
56
|
+
* // Rotate the group by 1 degree from
|
|
57
|
+
* // the centerpoint of the view:
|
|
58
|
+
* group.rotate(1, view.center);
|
|
59
|
+
* }
|
|
60
|
+
*/
|
|
61
|
+
constructor(children?: Item[]);
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new Group item and places it at the top of the active layer.
|
|
64
|
+
*
|
|
65
|
+
* @param object an object containing the properties to be set on the group
|
|
66
|
+
*
|
|
67
|
+
* @example {@paperscript}
|
|
68
|
+
* var path = new Path([100, 100], [100, 200]);
|
|
69
|
+
* var path2 = new Path([50, 150], [150, 150]);
|
|
70
|
+
*
|
|
71
|
+
* // Create a group from the two paths:
|
|
72
|
+
* var group = new Group({
|
|
73
|
+
* children: [path, path2],
|
|
74
|
+
* // Set the stroke color of all items in the group:
|
|
75
|
+
* strokeColor: 'black',
|
|
76
|
+
* // Move the group to the center of the view:
|
|
77
|
+
* position: view.center
|
|
78
|
+
* });
|
|
79
|
+
*/
|
|
80
|
+
constructor(object: ItemProps<Group>);
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new Group item from the passed items and places it at the top
|
|
83
|
+
* of the active layer.
|
|
84
|
+
*
|
|
85
|
+
* @param children the items that will be added to the newly created group
|
|
86
|
+
*
|
|
87
|
+
* @example {@paperscript}
|
|
88
|
+
* var path = new Path([100, 100], [100, 200]);
|
|
89
|
+
* var path2 = new Path([50, 150], [150, 150]);
|
|
90
|
+
*
|
|
91
|
+
* // Create a group from the two paths:
|
|
92
|
+
* var group = new Group(path, path2);
|
|
93
|
+
* group.strokeColor = 'black';
|
|
94
|
+
*/
|
|
95
|
+
constructor(...children: Item[]);
|
|
96
|
+
_getStyleFields(): null;
|
|
97
|
+
_getStyleDefaults(): Record<string, any>;
|
|
98
|
+
_getStyles(): Style[] | null;
|
|
99
|
+
_changed(flags: number): void;
|
|
100
|
+
_getClipItem(): Item | null;
|
|
101
|
+
/**
|
|
102
|
+
* Specifies whether the group item is to be clipped. When setting to
|
|
103
|
+
* `true`, the first child in the group is automatically defined as the
|
|
104
|
+
* clipping mask.
|
|
105
|
+
*
|
|
106
|
+
* @example {@paperscript}
|
|
107
|
+
* var star = Path.star({
|
|
108
|
+
* center: view.center,
|
|
109
|
+
* points: 6,
|
|
110
|
+
* radius1: 20,
|
|
111
|
+
* radius2: 40,
|
|
112
|
+
* fillColor: 'red'
|
|
113
|
+
* });
|
|
114
|
+
*
|
|
115
|
+
* var circle = Path.circle({
|
|
116
|
+
* center: view.center,
|
|
117
|
+
* radius: 25,
|
|
118
|
+
* strokeColor: 'black'
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Create a group of the two items and clip it:
|
|
122
|
+
* var group = new Group(circle, star);
|
|
123
|
+
* group.clipped = true;
|
|
124
|
+
*
|
|
125
|
+
* // Let's animate the circle:
|
|
126
|
+
* function onFrame(event) {
|
|
127
|
+
* var offset = Math.sin(event.count / 30) * 30;
|
|
128
|
+
* circle.position.x = view.center.x + offset;
|
|
129
|
+
* }
|
|
130
|
+
*/
|
|
131
|
+
get clipped(): boolean;
|
|
132
|
+
set clipped(clipped: boolean);
|
|
133
|
+
/**
|
|
134
|
+
* Replaces the group with its children, which keep their appearance: the
|
|
135
|
+
* group's matrix is applied to them, and its clipping mask is released.
|
|
136
|
+
*
|
|
137
|
+
* @return the children, or `null` if the group has no parent
|
|
138
|
+
*/
|
|
139
|
+
ungroup(): Item[] | null;
|
|
140
|
+
/**
|
|
141
|
+
* Specifies whether the group is isolated, drawn through a temporary
|
|
142
|
+
* canvas, so that the blend modes of its children only apply within it,
|
|
143
|
+
* like CSS's `isolation: isolate`. Without it, a compositing mode such as
|
|
144
|
+
* `'destination-out'` affects everything drawn below the group, also in
|
|
145
|
+
* other layers. Groups with an {@link Item#opacity} below 1 or a
|
|
146
|
+
* {@link Item#blendMode} are isolated anyway, and buffered groups always,
|
|
147
|
+
* see {@link #buffered}.
|
|
148
|
+
*
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
get isolated(): boolean;
|
|
152
|
+
set isolated(isolated: boolean);
|
|
153
|
+
/**
|
|
154
|
+
* Specifies whether the group is buffered: when a view draws it, it draws
|
|
155
|
+
* its content into a canvas of its own, which it keeps, and only draws
|
|
156
|
+
* into it again when something in the group changes, or the part of it
|
|
157
|
+
* that the view shows does, e.g. after zooming or panning. Otherwise, the
|
|
158
|
+
* view only composites the buffer, with the group's {@link Item#opacity}
|
|
159
|
+
* and {@link Item#blendMode}. This pays off for large groups and layers
|
|
160
|
+
* that rarely change, such as a complex background below animated items.
|
|
161
|
+
*
|
|
162
|
+
* It doesn't pay off when the buffer is drawn again on every frame: while
|
|
163
|
+
* the view pans or zooms on every frame, while the group itself is moved
|
|
164
|
+
* or transformed, or when an item inside it is animated. Put animated
|
|
165
|
+
* items into another group or layer instead.
|
|
166
|
+
*
|
|
167
|
+
* The buffer costs memory: it covers the part of the group that the view
|
|
168
|
+
* shows, at up to `width × height × 4 × pixelRatio²` bytes for a group
|
|
169
|
+
* that fills the whole view.
|
|
170
|
+
*
|
|
171
|
+
* Buffered groups are always {@link #isolated}: the blend modes of their
|
|
172
|
+
* children only apply within them, not to the items below them, also in
|
|
173
|
+
* other layers.
|
|
174
|
+
*
|
|
175
|
+
* Hit-testing, SVG export, {@link Item#rasterize()} and drawing into other
|
|
176
|
+
* canvases than the view's don't use the buffer.
|
|
177
|
+
*
|
|
178
|
+
* A buffered group keeps one buffer, so inside a {@link SymbolDefinition}
|
|
179
|
+
* that is placed several times, it draws into it again for each placement.
|
|
180
|
+
* Changes to any symbol definition make all buffers stale, as do forced
|
|
181
|
+
* updates through `view.update(true)`.
|
|
182
|
+
*
|
|
183
|
+
* @default false
|
|
184
|
+
*
|
|
185
|
+
* @example {@paperscript height=200}
|
|
186
|
+
* // Draw many circles into a buffered layer, which is drawn once, while
|
|
187
|
+
* // the circle in the layer above moves on every frame:
|
|
188
|
+
* var background = project.activeLayer;
|
|
189
|
+
* background.buffered = true;
|
|
190
|
+
* for (var i = 0; i < 2000; i++) {
|
|
191
|
+
* Path.circle({
|
|
192
|
+
* center: Point.random() * view.size,
|
|
193
|
+
* radius: 5 + Math.random() * 10,
|
|
194
|
+
* fillColor: { hue: Math.random() * 360, saturation: 0.5,
|
|
195
|
+
* brightness: 1 },
|
|
196
|
+
* opacity: 0.5
|
|
197
|
+
* });
|
|
198
|
+
* }
|
|
199
|
+
*
|
|
200
|
+
* var circle = Path.circle({
|
|
201
|
+
* center: view.center,
|
|
202
|
+
* radius: 20,
|
|
203
|
+
* fillColor: 'black'
|
|
204
|
+
* });
|
|
205
|
+
* new Layer([circle]);
|
|
206
|
+
*
|
|
207
|
+
* function onFrame(event) {
|
|
208
|
+
* circle.position.x = view.center.x + Math.sin(event.time) * 100;
|
|
209
|
+
* }
|
|
210
|
+
*/
|
|
211
|
+
get buffered(): boolean;
|
|
212
|
+
set buffered(buffered: boolean);
|
|
213
|
+
_remove(notifySelf: boolean, notifyParent: boolean): boolean;
|
|
214
|
+
_serialize(options: JSONOptions, dictionary: JSONDictionary): any[];
|
|
215
|
+
_getBounds(matrix: Matrix | null, options: BoundsOptions): Rectangle | {
|
|
216
|
+
rect: Rectangle;
|
|
217
|
+
nonscaling: boolean;
|
|
218
|
+
};
|
|
219
|
+
_hitTestChildren(point: Point, options: HitTestOptions, viewMatrix?: Matrix | null): HitResult | null;
|
|
220
|
+
_hitTestSelf(point: Point, options: HitTestOptions, viewMatrix?: Matrix | null): HitResult | null;
|
|
221
|
+
_draw(ctx: CanvasRenderingContext2D, param: DrawParam): void;
|
|
222
|
+
_drawGeometry(ctx: CanvasRenderingContext2D, matrix: Matrix | null): void;
|
|
223
|
+
}
|
|
224
|
+
export interface Group extends TextStyleProperties {
|
|
225
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Base } from '../internal.ts';
|
|
2
|
+
import type { Point } from '../basic/Point.ts';
|
|
3
|
+
import type { Color } from '../style/Color.ts';
|
|
4
|
+
import type { CurveLocation } from '../path/CurveLocation.ts';
|
|
5
|
+
import type { Segment } from '../path/Segment.ts';
|
|
6
|
+
import type { Item } from './Item.ts';
|
|
7
|
+
import type { Size } from '../basic/Size.ts';
|
|
8
|
+
export type HitType = 'segment' | 'handle-in' | 'handle-out' | 'curve' | 'stroke' | 'fill' | 'bounds' | 'center' | 'position' | 'pixel';
|
|
9
|
+
/**
|
|
10
|
+
* The options of hit-tests, see {@link Item#hitTest(point[, options])}.
|
|
11
|
+
*/
|
|
12
|
+
export type HitTestOptions = {
|
|
13
|
+
tolerance?: number;
|
|
14
|
+
class?: abstract new (...args: any[]) => any;
|
|
15
|
+
type?: HitType | null;
|
|
16
|
+
match?: (hit: HitResult) => boolean;
|
|
17
|
+
fill?: boolean;
|
|
18
|
+
stroke?: boolean;
|
|
19
|
+
segments?: boolean;
|
|
20
|
+
curves?: boolean;
|
|
21
|
+
handles?: boolean;
|
|
22
|
+
ends?: boolean;
|
|
23
|
+
position?: boolean;
|
|
24
|
+
center?: boolean;
|
|
25
|
+
bounds?: boolean;
|
|
26
|
+
guides?: boolean;
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
all?: HitResult[];
|
|
29
|
+
_tolerancePadding?: Size;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A HitResult object contains information about the results of a hit test. It
|
|
33
|
+
* is returned by {@link Item#hitTest(point)} and
|
|
34
|
+
* {@link Project#hitTest(point)}.
|
|
35
|
+
*/
|
|
36
|
+
export declare class HitResult extends Base {
|
|
37
|
+
/**
|
|
38
|
+
* Describes the type of the hit result. For example, if you hit a segment
|
|
39
|
+
* point, the type would be `'segment'`.
|
|
40
|
+
*
|
|
41
|
+
* @values 'segment', 'handle-in', 'handle-out', 'curve', 'stroke', 'fill',
|
|
42
|
+
* 'bounds', 'center', 'position', 'pixel'
|
|
43
|
+
*/
|
|
44
|
+
type: HitType;
|
|
45
|
+
/**
|
|
46
|
+
* If the HitResult has a {@link HitResult#type} of `'bounds'`, this
|
|
47
|
+
* property describes which corner of the bounding rectangle was hit.
|
|
48
|
+
*
|
|
49
|
+
* The names refer to the item's own bounding rectangle, transformed by its
|
|
50
|
+
* {@link Item#matrix}, which is the rectangle that the item's selection
|
|
51
|
+
* draws. On mirrored or rotated items, a handle can therefore appear
|
|
52
|
+
* elsewhere on screen than its name says, while its opposite handle and
|
|
53
|
+
* the rectangle's axes stay the ones to transform the item by. To choose
|
|
54
|
+
* a cursor, use the direction from the rectangle's center to
|
|
55
|
+
* {@link HitResult#point}, both in project coordinates.
|
|
56
|
+
*
|
|
57
|
+
* @values 'top-left', 'top-right', 'bottom-left', 'bottom-right',
|
|
58
|
+
* 'left-center', 'top-center', 'right-center', 'bottom-center'
|
|
59
|
+
*/
|
|
60
|
+
name?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The item that was hit.
|
|
63
|
+
*/
|
|
64
|
+
item: Item;
|
|
65
|
+
/**
|
|
66
|
+
* If the HitResult has a type of 'curve' or 'stroke', this property gives
|
|
67
|
+
* more information about the exact position that was hit on the path.
|
|
68
|
+
*/
|
|
69
|
+
location?: CurveLocation;
|
|
70
|
+
/**
|
|
71
|
+
* If the HitResult has a type of 'stroke', 'segment', 'handle-in' or
|
|
72
|
+
* 'handle-out', this property refers to the segment that was hit or that
|
|
73
|
+
* is closest to the hitResult.location on the curve.
|
|
74
|
+
*/
|
|
75
|
+
segment?: Segment;
|
|
76
|
+
/**
|
|
77
|
+
* Describes the actual coordinates of the segment, handle or bounding box
|
|
78
|
+
* corner that was hit.
|
|
79
|
+
*/
|
|
80
|
+
point?: Point;
|
|
81
|
+
offset?: Point;
|
|
82
|
+
constructor(type: HitType, item: Item, values?: Partial<HitResult>);
|
|
83
|
+
/**
|
|
84
|
+
* If the HitResult has a type of 'pixel', this property refers to the color
|
|
85
|
+
* of the pixel on the {@link Raster} that was hit.
|
|
86
|
+
*/
|
|
87
|
+
get color(): Color | null;
|
|
88
|
+
/**
|
|
89
|
+
* Merges default options into options hash for #hitTest() calls.
|
|
90
|
+
*
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
static getOptions(options?: HitTestOptions): HitTestOptions;
|
|
94
|
+
}
|