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,781 @@
|
|
|
1
|
+
import { Formatter } from '../util/Formatter.ts';
|
|
2
|
+
import { Base } from '../core/Base.ts';
|
|
3
|
+
import type { RectangleLike } from './Rectangle.ts';
|
|
4
|
+
import type { Size } from './Size.ts';
|
|
5
|
+
import type { Matrix } from './Matrix.ts';
|
|
6
|
+
/**
|
|
7
|
+
* What a point can be passed as, where a function takes one.
|
|
8
|
+
*/
|
|
9
|
+
export type PointLike = Point | number[] | {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
} | {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
} | {
|
|
16
|
+
angle: number;
|
|
17
|
+
length: number;
|
|
18
|
+
} | {
|
|
19
|
+
angleInRadians: number;
|
|
20
|
+
length: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The Point object represents a point in the two dimensional space
|
|
24
|
+
* of the Paper.js project. It is also used to represent two dimensional
|
|
25
|
+
* vector objects.
|
|
26
|
+
*
|
|
27
|
+
* Wherever a point is the only argument of a function, it can also be passed
|
|
28
|
+
* as two numbers, e.g. `point.add(10, 20)` or `item.translate(10, 20)`.
|
|
29
|
+
*
|
|
30
|
+
* @classexample
|
|
31
|
+
* // Create a point at x: 10, y: 5
|
|
32
|
+
* var point = new Point(10, 5);
|
|
33
|
+
* console.log(point.x); // 10
|
|
34
|
+
* console.log(point.y); // 5
|
|
35
|
+
*/
|
|
36
|
+
export declare class Point extends Base {
|
|
37
|
+
#private;
|
|
38
|
+
/**
|
|
39
|
+
* The x coordinate of the point
|
|
40
|
+
*/
|
|
41
|
+
x: number;
|
|
42
|
+
/**
|
|
43
|
+
* The y coordinate of the point
|
|
44
|
+
*/
|
|
45
|
+
y: number;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Point object with the given x and y coordinates.
|
|
48
|
+
*
|
|
49
|
+
* @param x the x coordinate
|
|
50
|
+
* @param [y=x] the y coordinate
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Create a point at x: 10, y: 5
|
|
54
|
+
* var point = new Point(10, 5);
|
|
55
|
+
* console.log(point.x); // 10
|
|
56
|
+
* console.log(point.y); // 5
|
|
57
|
+
*/
|
|
58
|
+
constructor(x: number, y?: number);
|
|
59
|
+
/**
|
|
60
|
+
* Creates a Point object using the numbers in the given array as
|
|
61
|
+
* coordinates.
|
|
62
|
+
*
|
|
63
|
+
* @param array
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Creating a point at x: 10, y: 5 using an array of numbers:
|
|
67
|
+
* var array = [10, 5];
|
|
68
|
+
* var point = new Point(array);
|
|
69
|
+
* console.log(point.x); // 10
|
|
70
|
+
* console.log(point.y); // 5
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // Passing an array to a functionality that expects a point:
|
|
74
|
+
*
|
|
75
|
+
* // Create a circle shaped path at x: 50, y: 50
|
|
76
|
+
* // with a radius of 30:
|
|
77
|
+
* var path = Path.circle([50, 50], 30);
|
|
78
|
+
* path.fillColor = 'red';
|
|
79
|
+
*
|
|
80
|
+
* // Which is the same as doing:
|
|
81
|
+
* var path = Path.circle(new Point(50, 50), 30);
|
|
82
|
+
* path.fillColor = 'red';
|
|
83
|
+
*/
|
|
84
|
+
constructor(array: number[]);
|
|
85
|
+
/**
|
|
86
|
+
* Creates a Point object using the properties in the given object.
|
|
87
|
+
*
|
|
88
|
+
* @param object the object describing the point's properties
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Creating a point using an object literal with length and angle
|
|
92
|
+
* // properties:
|
|
93
|
+
*
|
|
94
|
+
* var point = new Point({
|
|
95
|
+
* length: 10,
|
|
96
|
+
* angle: 90
|
|
97
|
+
* });
|
|
98
|
+
* console.log(point.length); // 10
|
|
99
|
+
* console.log(point.angle); // 90
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // The angle can also be specified in radians:
|
|
103
|
+
*
|
|
104
|
+
* var point = new Point({
|
|
105
|
+
* length: 10,
|
|
106
|
+
* angleInRadians: Math.PI / 2
|
|
107
|
+
* });
|
|
108
|
+
* console.log(point.angle); // 90
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Creating a point at x: 10, y: 20 using an object literal:
|
|
112
|
+
*
|
|
113
|
+
* var point = new Point({
|
|
114
|
+
* x: 10,
|
|
115
|
+
* y: 20
|
|
116
|
+
* });
|
|
117
|
+
* console.log(point.x); // 10
|
|
118
|
+
* console.log(point.y); // 20
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* // Passing an object to a functionality that expects a point:
|
|
122
|
+
*
|
|
123
|
+
* var center = {
|
|
124
|
+
* x: 50,
|
|
125
|
+
* y: 50
|
|
126
|
+
* };
|
|
127
|
+
*
|
|
128
|
+
* // Creates a circle shaped path at x: 50, y: 50
|
|
129
|
+
* // with a radius of 30:
|
|
130
|
+
* var path = Path.circle(center, 30);
|
|
131
|
+
* path.fillColor = 'red';
|
|
132
|
+
*/
|
|
133
|
+
constructor(object: {
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
} | {
|
|
137
|
+
angle: number;
|
|
138
|
+
length: number;
|
|
139
|
+
} | {
|
|
140
|
+
angleInRadians: number;
|
|
141
|
+
length: number;
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Creates a Point object using the width and height values of the given
|
|
145
|
+
* Size object.
|
|
146
|
+
*
|
|
147
|
+
* @param size
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* // Creating a point using a size object.
|
|
151
|
+
*
|
|
152
|
+
* // Create a Size with a width of 100pt and a height of 50pt
|
|
153
|
+
* var size = new Size(100, 50);
|
|
154
|
+
* console.log(size); // { width: 100, height: 50 }
|
|
155
|
+
* var point = new Point(size);
|
|
156
|
+
* console.log(point); // { x: 100, y: 50 }
|
|
157
|
+
*/
|
|
158
|
+
constructor(size: Size);
|
|
159
|
+
/**
|
|
160
|
+
* Creates a Point object using the coordinates of the given Point object.
|
|
161
|
+
*
|
|
162
|
+
* @param point
|
|
163
|
+
*/
|
|
164
|
+
constructor(point?: Point);
|
|
165
|
+
constructor(point?: PointLike | number, y?: number);
|
|
166
|
+
/**
|
|
167
|
+
* Sets the point to the passed values. Note that any sequence of parameters
|
|
168
|
+
* that is supported by the various {@link Point()} constructors also work
|
|
169
|
+
* for calls of `set()`.
|
|
170
|
+
*
|
|
171
|
+
* @param point the point, or its x-coordinate
|
|
172
|
+
* @param y the y-coordinate, with a number as the first argument
|
|
173
|
+
*/
|
|
174
|
+
set(point?: PointLike | number, y?: number): this;
|
|
175
|
+
/**
|
|
176
|
+
* Internal helper function to directly set the underlying properties.
|
|
177
|
+
*
|
|
178
|
+
* Convention regarding {@link #set()} VS {@link #_set()}:
|
|
179
|
+
*
|
|
180
|
+
* - {@link #_set()} is for actually setting properties, e.g. on Point,
|
|
181
|
+
* Size, so that derived classes can reuse other parts (e.g. SegmentPoint)
|
|
182
|
+
* - {@link #set()} takes the same arguments as the constructor on all
|
|
183
|
+
* basic types, to offer the same amount of flexibility when setting
|
|
184
|
+
* values.
|
|
185
|
+
*/
|
|
186
|
+
_set(x: number, y: number): this;
|
|
187
|
+
/**
|
|
188
|
+
* Checks whether the coordinates of the point are equal to that of the
|
|
189
|
+
* supplied point.
|
|
190
|
+
*
|
|
191
|
+
* @param point
|
|
192
|
+
* @return {@true if the points are equal}
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* var point = new Point(5, 10);
|
|
196
|
+
* console.log(point == new Point(5, 10)); // true
|
|
197
|
+
* console.log(point == new Point(1, 1)); // false
|
|
198
|
+
* console.log(point != new Point(1, 1)); // true
|
|
199
|
+
*/
|
|
200
|
+
equals(point: PointLike | null | undefined): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Returns a copy of the point.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* var point1 = new Point();
|
|
206
|
+
* var point2 = point1;
|
|
207
|
+
* point2.x = 1; // also changes point1.x
|
|
208
|
+
*
|
|
209
|
+
* var point2 = point1.clone();
|
|
210
|
+
* point2.x = 1; // doesn't change point1.x
|
|
211
|
+
*
|
|
212
|
+
* @return the cloned point
|
|
213
|
+
*/
|
|
214
|
+
clone(): Point;
|
|
215
|
+
/**
|
|
216
|
+
* @return a string representation of the point
|
|
217
|
+
*/
|
|
218
|
+
toString(): string;
|
|
219
|
+
_serialize(options: {
|
|
220
|
+
formatter: Formatter;
|
|
221
|
+
}): number[];
|
|
222
|
+
/**
|
|
223
|
+
* The point's coordinates as an array, `[x, y]`, as
|
|
224
|
+
* {@link Matrix#values} gives those of a matrix.
|
|
225
|
+
*/
|
|
226
|
+
get values(): number[];
|
|
227
|
+
/**
|
|
228
|
+
* The length of the vector that is represented by this point's coordinates.
|
|
229
|
+
* Each point can be interpreted as a vector that points from the origin (`x
|
|
230
|
+
* = 0`, `y = 0`) to the point's location. Setting the length changes the
|
|
231
|
+
* location but keeps the vector's angle.
|
|
232
|
+
*/
|
|
233
|
+
get length(): number;
|
|
234
|
+
set length(length: number);
|
|
235
|
+
/**
|
|
236
|
+
* The vector's angle in degrees, measured from the x-axis to the vector.
|
|
237
|
+
*/
|
|
238
|
+
get angle(): number;
|
|
239
|
+
set angle(angle: number);
|
|
240
|
+
/**
|
|
241
|
+
* The vector's angle in radians, measured from the x-axis to the vector.
|
|
242
|
+
*/
|
|
243
|
+
get angleInRadians(): number;
|
|
244
|
+
set angleInRadians(angle: number);
|
|
245
|
+
/**
|
|
246
|
+
* Returns the smaller angle between two vectors. The angle is unsigned, no
|
|
247
|
+
* information about rotational direction is given.
|
|
248
|
+
*
|
|
249
|
+
* @param point
|
|
250
|
+
* @return the angle in degrees
|
|
251
|
+
*/
|
|
252
|
+
getAngle(point: PointLike | number, y?: number): number;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the smaller angle between two vectors in radians. The angle is
|
|
255
|
+
* unsigned, no information about rotational direction is given.
|
|
256
|
+
*
|
|
257
|
+
* @param point
|
|
258
|
+
* @return the angle in radians
|
|
259
|
+
*/
|
|
260
|
+
getAngleInRadians(point: PointLike | number, y?: number): number;
|
|
261
|
+
/**
|
|
262
|
+
* The quadrant of the {@link #angle} of the point.
|
|
263
|
+
*
|
|
264
|
+
* Angles between 0 and 90 degrees are in quadrant `1`. Angles between 90
|
|
265
|
+
* and 180 degrees are in quadrant `2`, angles between 180 and 270 degrees
|
|
266
|
+
* are in quadrant `3` and angles between 270 and 360 degrees are in
|
|
267
|
+
* quadrant `4`.
|
|
268
|
+
*
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* var point = new Point({
|
|
272
|
+
* angle: 10,
|
|
273
|
+
* length: 20
|
|
274
|
+
* });
|
|
275
|
+
* console.log(point.quadrant); // 1
|
|
276
|
+
*
|
|
277
|
+
* point.angle = 100;
|
|
278
|
+
* console.log(point.quadrant); // 2
|
|
279
|
+
*
|
|
280
|
+
* point.angle = 190;
|
|
281
|
+
* console.log(point.quadrant); // 3
|
|
282
|
+
*
|
|
283
|
+
* point.angle = 280;
|
|
284
|
+
* console.log(point.quadrant); // 4
|
|
285
|
+
*/
|
|
286
|
+
get quadrant(): number;
|
|
287
|
+
/**
|
|
288
|
+
* Returns the angle between two vectors. The angle is directional and
|
|
289
|
+
* signed, giving information about the rotational direction.
|
|
290
|
+
*
|
|
291
|
+
* Read more about angle units and orientation in the description of the
|
|
292
|
+
* {@link #angle} property.
|
|
293
|
+
*
|
|
294
|
+
* @param point
|
|
295
|
+
* @return the angle between the two vectors
|
|
296
|
+
*/
|
|
297
|
+
getDirectedAngle(point: PointLike | number, y?: number): number;
|
|
298
|
+
/**
|
|
299
|
+
* Returns the distance between the point and another point.
|
|
300
|
+
*
|
|
301
|
+
* @param point
|
|
302
|
+
* @param [squared=false] controls whether the distance should remain
|
|
303
|
+
* squared, or its square root should be calculated
|
|
304
|
+
*/
|
|
305
|
+
getDistance(point: PointLike, squared?: boolean): number;
|
|
306
|
+
/**
|
|
307
|
+
* Normalize modifies the {@link #length} of the vector to `1` without
|
|
308
|
+
* changing its angle and returns it as a new point. The optional `length`
|
|
309
|
+
* parameter defines the length to normalize to. The object itself is not
|
|
310
|
+
* modified!
|
|
311
|
+
*
|
|
312
|
+
* @param length The length of the normalized vector
|
|
313
|
+
* @return the normalized vector of the vector that is represented
|
|
314
|
+
* by this point's coordinates
|
|
315
|
+
*/
|
|
316
|
+
normalize(length?: number): Point;
|
|
317
|
+
/**
|
|
318
|
+
* Rotates the point by the given angle around an optional center point.
|
|
319
|
+
* The object itself is not modified.
|
|
320
|
+
*
|
|
321
|
+
* Read more about angle units and orientation in the description of the
|
|
322
|
+
* {@link #angle} property.
|
|
323
|
+
*
|
|
324
|
+
* @param angle the rotation angle
|
|
325
|
+
* @param center the center point of the rotation
|
|
326
|
+
* @return the rotated point
|
|
327
|
+
*/
|
|
328
|
+
rotate(angle: number, center?: PointLike): Point;
|
|
329
|
+
/**
|
|
330
|
+
* Transforms the point by the matrix as a new point. The object itself is
|
|
331
|
+
* not modified!
|
|
332
|
+
*
|
|
333
|
+
* @param matrix
|
|
334
|
+
* @return the transformed point
|
|
335
|
+
*/
|
|
336
|
+
transform(matrix?: Matrix | null): Point;
|
|
337
|
+
/**
|
|
338
|
+
* Returns the addition of the supplied value to both coordinates of
|
|
339
|
+
* the point as a new point.
|
|
340
|
+
* The object itself is not modified!
|
|
341
|
+
*
|
|
342
|
+
* @operator
|
|
343
|
+
* @param number the number to add
|
|
344
|
+
* @return the addition of the point and the value as a new point
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* var point = new Point(5, 10);
|
|
348
|
+
* var result = point + 20; // PaperScript
|
|
349
|
+
* var result = point.add(20); // JavaScript
|
|
350
|
+
* console.log(result); // {x: 25, y: 30}
|
|
351
|
+
*/
|
|
352
|
+
add(number: number): Point;
|
|
353
|
+
/**
|
|
354
|
+
* Returns the addition of the supplied point to the point as a new
|
|
355
|
+
* point.
|
|
356
|
+
* The object itself is not modified!
|
|
357
|
+
*
|
|
358
|
+
* @operator
|
|
359
|
+
* @param point the point to add
|
|
360
|
+
* @return the addition of the two points as a new point
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* var point1 = new Point(5, 10);
|
|
364
|
+
* var point2 = new Point(10, 20);
|
|
365
|
+
* var result = point1 + point2; // PaperScript
|
|
366
|
+
* var result = point1.add(point2); // JavaScript
|
|
367
|
+
* console.log(result); // {x: 15, y: 30}
|
|
368
|
+
*/
|
|
369
|
+
add(point: PointLike): Point;
|
|
370
|
+
add(x: number, y: number): Point;
|
|
371
|
+
/**
|
|
372
|
+
* Returns the subtraction of the supplied value to both coordinates of
|
|
373
|
+
* the point as a new point.
|
|
374
|
+
* The object itself is not modified!
|
|
375
|
+
*
|
|
376
|
+
* @operator
|
|
377
|
+
* @param number the number to subtract
|
|
378
|
+
* @return the subtraction of the point and the value as a new point
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* var point = new Point(10, 20);
|
|
382
|
+
* var result = point - 5; // PaperScript
|
|
383
|
+
* var result = point.subtract(5); // JavaScript
|
|
384
|
+
* console.log(result); // {x: 5, y: 15}
|
|
385
|
+
*/
|
|
386
|
+
subtract(number: number): Point;
|
|
387
|
+
/**
|
|
388
|
+
* Returns the subtraction of the supplied point to the point as a new
|
|
389
|
+
* point.
|
|
390
|
+
* The object itself is not modified!
|
|
391
|
+
*
|
|
392
|
+
* @operator
|
|
393
|
+
* @param point the point to subtract
|
|
394
|
+
* @return the subtraction of the two points as a new point
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* var firstPoint = new Point(10, 20);
|
|
398
|
+
* var secondPoint = new Point(5, 5);
|
|
399
|
+
* var result = firstPoint - secondPoint; // PaperScript
|
|
400
|
+
* var result = firstPoint.subtract(secondPoint); // JavaScript
|
|
401
|
+
* console.log(result); // {x: 5, y: 15}
|
|
402
|
+
*/
|
|
403
|
+
subtract(point: PointLike): Point;
|
|
404
|
+
subtract(x: number, y: number): Point;
|
|
405
|
+
/**
|
|
406
|
+
* Returns the multiplication of the supplied value to both coordinates of
|
|
407
|
+
* the point as a new point.
|
|
408
|
+
* The object itself is not modified!
|
|
409
|
+
*
|
|
410
|
+
* @operator
|
|
411
|
+
* @param number the number to multiply by
|
|
412
|
+
* @return the multiplication of the point and the value as a new
|
|
413
|
+
* point
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* var point = new Point(10, 20);
|
|
417
|
+
* var result = point * 2; // PaperScript
|
|
418
|
+
* var result = point.multiply(2); // JavaScript
|
|
419
|
+
* console.log(result); // {x: 20, y: 40}
|
|
420
|
+
*/
|
|
421
|
+
multiply(number: number): Point;
|
|
422
|
+
/**
|
|
423
|
+
* Returns the multiplication of the supplied point to the point as a new
|
|
424
|
+
* point.
|
|
425
|
+
* The object itself is not modified!
|
|
426
|
+
*
|
|
427
|
+
* @operator
|
|
428
|
+
* @param point the point to multiply by
|
|
429
|
+
* @return the multiplication of the two points as a new point
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* var firstPoint = new Point(5, 10);
|
|
433
|
+
* var secondPoint = new Point(4, 2);
|
|
434
|
+
* var result = firstPoint * secondPoint; // PaperScript
|
|
435
|
+
* var result = firstPoint.multiply(secondPoint); // JavaScript
|
|
436
|
+
* console.log(result); // {x: 20, y: 20}
|
|
437
|
+
*/
|
|
438
|
+
multiply(point: PointLike): Point;
|
|
439
|
+
multiply(x: number, y: number): Point;
|
|
440
|
+
/**
|
|
441
|
+
* Returns the division of the supplied value to both coordinates of
|
|
442
|
+
* the point as a new point.
|
|
443
|
+
* The object itself is not modified!
|
|
444
|
+
*
|
|
445
|
+
* @operator
|
|
446
|
+
* @param number the number to divide by
|
|
447
|
+
* @return the division of the point and the value as a new point
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* var point = new Point(10, 20);
|
|
451
|
+
* var result = point / 2; // PaperScript
|
|
452
|
+
* var result = point.divide(2); // JavaScript
|
|
453
|
+
* console.log(result); // {x: 5, y: 10}
|
|
454
|
+
*/
|
|
455
|
+
divide(number: number): Point;
|
|
456
|
+
/**
|
|
457
|
+
* Returns the division of the supplied point to the point as a new
|
|
458
|
+
* point.
|
|
459
|
+
* The object itself is not modified!
|
|
460
|
+
*
|
|
461
|
+
* @operator
|
|
462
|
+
* @param point the point to divide by
|
|
463
|
+
* @return the division of the two points as a new point
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* var firstPoint = new Point(8, 10);
|
|
467
|
+
* var secondPoint = new Point(2, 5);
|
|
468
|
+
* var result = firstPoint / secondPoint; // PaperScript
|
|
469
|
+
* var result = firstPoint.divide(secondPoint); // JavaScript
|
|
470
|
+
* console.log(result); // {x: 4, y: 2}
|
|
471
|
+
*/
|
|
472
|
+
divide(point: PointLike): Point;
|
|
473
|
+
divide(x: number, y: number): Point;
|
|
474
|
+
/**
|
|
475
|
+
* The modulo operator returns the integer remainders of dividing the point
|
|
476
|
+
* by the supplied value as a new point.
|
|
477
|
+
*
|
|
478
|
+
* @operator
|
|
479
|
+
* @param value
|
|
480
|
+
* @return the integer remainders of dividing the point by the value
|
|
481
|
+
* as a new point
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* var point = new Point(12, 6);
|
|
485
|
+
* var result = point % 5; // PaperScript
|
|
486
|
+
* var result = point.modulo(5); // JavaScript
|
|
487
|
+
* console.log(result); // {x: 2, y: 1}
|
|
488
|
+
*/
|
|
489
|
+
modulo(value: number): Point;
|
|
490
|
+
/**
|
|
491
|
+
* The modulo operator returns the integer remainders of dividing the point
|
|
492
|
+
* by the supplied value as a new point.
|
|
493
|
+
*
|
|
494
|
+
* @operator
|
|
495
|
+
* @param point
|
|
496
|
+
* @return the integer remainders of dividing the points by each
|
|
497
|
+
* other as a new point
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* var point = new Point(12, 6);
|
|
501
|
+
* var result = point % new Point(5, 2); // PaperScript
|
|
502
|
+
* var result = point.modulo(new Point(5, 2)); // JavaScript
|
|
503
|
+
* console.log(result); // {x: 2, y: 0}
|
|
504
|
+
*/
|
|
505
|
+
modulo(point: PointLike): Point;
|
|
506
|
+
modulo(x: number, y: number): Point;
|
|
507
|
+
/**
|
|
508
|
+
* Returns a new point with both coordinates negated.
|
|
509
|
+
* PaperScript uses it for the unary minus operator.
|
|
510
|
+
* The object itself is not modified!
|
|
511
|
+
*
|
|
512
|
+
* @return the negation of the point as a new point
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* var point = new Point(12, -6);
|
|
516
|
+
* var result = -point; // PaperScript
|
|
517
|
+
* var result = point.negate(); // JavaScript
|
|
518
|
+
* console.log(result); // {x: -12, y: 6}
|
|
519
|
+
*/
|
|
520
|
+
negate(): Point;
|
|
521
|
+
/**
|
|
522
|
+
* {@grouptitle Tests}
|
|
523
|
+
*
|
|
524
|
+
* Checks whether the point is inside the boundaries of the rectangle.
|
|
525
|
+
*
|
|
526
|
+
* @param rect the rectangle to check against
|
|
527
|
+
* @return {@true if the point is inside the rectangle}
|
|
528
|
+
*/
|
|
529
|
+
isInside(rect: RectangleLike): boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Checks if the point is within a given distance of another point.
|
|
532
|
+
*
|
|
533
|
+
* @param point the point to check against
|
|
534
|
+
* @param tolerance the maximum distance allowed
|
|
535
|
+
* @return {@true if it is within the given distance}
|
|
536
|
+
*/
|
|
537
|
+
isClose(point: PointLike, tolerance: number): boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Checks if the vector represented by this point is collinear (parallel) to
|
|
540
|
+
* another vector, within a tolerance of 1e-8 for the sine of the angle
|
|
541
|
+
* between them.
|
|
542
|
+
*
|
|
543
|
+
* @param point the vector to check against
|
|
544
|
+
* @return {@true if it is collinear}
|
|
545
|
+
*/
|
|
546
|
+
isCollinear(point: PointLike | number, y?: number): boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Checks if the vector represented by this point is orthogonal
|
|
549
|
+
* (perpendicular) to another vector, within a tolerance of 1e-8 for the
|
|
550
|
+
* cosine of the angle between them.
|
|
551
|
+
*
|
|
552
|
+
* @param point the vector to check against
|
|
553
|
+
* @return {@true if it is orthogonal}
|
|
554
|
+
*/
|
|
555
|
+
isOrthogonal(point: PointLike | number, y?: number): boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Checks if this point has both the x and y coordinate set to 0, within
|
|
558
|
+
* a tolerance of 1e-12, unlike {@link #equals(point)}, which compares
|
|
559
|
+
* exactly.
|
|
560
|
+
*
|
|
561
|
+
* @return {@true if both x and y are 0, within the tolerance}
|
|
562
|
+
*/
|
|
563
|
+
isZero(): boolean;
|
|
564
|
+
/**
|
|
565
|
+
* Checks if this point has an undefined value for at least one of its
|
|
566
|
+
* coordinates.
|
|
567
|
+
*
|
|
568
|
+
* @return {@true if either x or y are not a number}
|
|
569
|
+
*/
|
|
570
|
+
isNaN(): boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Checks if the vector is within the specified quadrant. Note that if the
|
|
573
|
+
* vector lies on the boundary between two quadrants, `true` will be
|
|
574
|
+
* returned for both quadrants.
|
|
575
|
+
*
|
|
576
|
+
* @param quadrant the quadrant to check against
|
|
577
|
+
* @return {@true if the vector is within the quadrant}
|
|
578
|
+
* @see #quadrant
|
|
579
|
+
*/
|
|
580
|
+
isInQuadrant(quadrant: number): boolean;
|
|
581
|
+
/**
|
|
582
|
+
* {@grouptitle Vector Math Functions}
|
|
583
|
+
* Returns the dot product of the point and another point.
|
|
584
|
+
*
|
|
585
|
+
* @param point
|
|
586
|
+
* @return the dot product of the two points
|
|
587
|
+
*/
|
|
588
|
+
dot(point: PointLike | number, y?: number): number;
|
|
589
|
+
/**
|
|
590
|
+
* Returns the cross product of the point and another point.
|
|
591
|
+
*
|
|
592
|
+
* @param point
|
|
593
|
+
* @return the cross product of the two points
|
|
594
|
+
*/
|
|
595
|
+
cross(point: PointLike | number, y?: number): number;
|
|
596
|
+
/**
|
|
597
|
+
* Returns the projection of the point onto another point.
|
|
598
|
+
* Both points are interpreted as vectors.
|
|
599
|
+
*
|
|
600
|
+
* @param point
|
|
601
|
+
* @return the projection of the point onto another point
|
|
602
|
+
*/
|
|
603
|
+
project(point: PointLike | number, y?: number): Point;
|
|
604
|
+
/**
|
|
605
|
+
* Returns a new point with the {@link #x} and {@link #y} values clamped to
|
|
606
|
+
* the range between the given minimum and maximum points. The object
|
|
607
|
+
* itself is not modified!
|
|
608
|
+
*
|
|
609
|
+
* @param min the point with the smallest values
|
|
610
|
+
* @param max the point with the largest values
|
|
611
|
+
* @return the clamped point as a new point
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* var point = new Point(-5, 150);
|
|
615
|
+
* var clampPoint = point.clamp(new Point(0, 0), new Point(100, 100));
|
|
616
|
+
* console.log(clampPoint); // {x: 0, y: 100}
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* // Keep a point inside a rectangle:
|
|
620
|
+
* var rect = new Rectangle(10, 20, 100, 50);
|
|
621
|
+
* var point = new Point(200, 40);
|
|
622
|
+
* var clampPoint = point.clamp(rect.topLeft, rect.bottomRight);
|
|
623
|
+
* console.log(clampPoint); // {x: 110, y: 40}
|
|
624
|
+
*/
|
|
625
|
+
clamp(min: PointLike, max: PointLike): Point;
|
|
626
|
+
/**
|
|
627
|
+
* Returns the passed point if it is one already, or else a new point
|
|
628
|
+
* created from the passed values, as {@link Point()} reads them. A number
|
|
629
|
+
* makes a point only together with its y-coordinate.
|
|
630
|
+
*
|
|
631
|
+
* @param point
|
|
632
|
+
* @param y
|
|
633
|
+
*/
|
|
634
|
+
static from(point?: PointLike | number, y?: number): Point;
|
|
635
|
+
/**
|
|
636
|
+
* Returns the passed point if it is one already, or else a new point
|
|
637
|
+
* created from the passed values, where a single number stands for both
|
|
638
|
+
* coordinates, as in `point.multiply(2)`, translations and scale factors.
|
|
639
|
+
*
|
|
640
|
+
* @param point
|
|
641
|
+
* @param y
|
|
642
|
+
*/
|
|
643
|
+
static coerce(point: PointLike | number, y?: number): Point;
|
|
644
|
+
/**
|
|
645
|
+
* Returns a new point object with the smallest {@link #x} and
|
|
646
|
+
* {@link #y} of the supplied points.
|
|
647
|
+
*
|
|
648
|
+
* @param point1
|
|
649
|
+
* @param point2
|
|
650
|
+
* @return the newly created point object
|
|
651
|
+
*
|
|
652
|
+
* @example
|
|
653
|
+
* var point1 = new Point(10, 100);
|
|
654
|
+
* var point2 = new Point(200, 5);
|
|
655
|
+
* var minPoint = Point.min(point1, point2);
|
|
656
|
+
* console.log(minPoint); // {x: 10, y: 5}
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* // Find the minimum of multiple points:
|
|
660
|
+
* var point1 = new Point(60, 100);
|
|
661
|
+
* var point2 = new Point(200, 5);
|
|
662
|
+
* var point3 = new Point(250, 35);
|
|
663
|
+
* [point1, point2, point3].reduce(Point.min) // {x: 60, y: 5}
|
|
664
|
+
*/
|
|
665
|
+
static min(point1: PointLike, point2: PointLike): Point;
|
|
666
|
+
/**
|
|
667
|
+
* Returns a new point object with the largest {@link #x} and
|
|
668
|
+
* {@link #y} of the supplied points.
|
|
669
|
+
*
|
|
670
|
+
* @param point1
|
|
671
|
+
* @param point2
|
|
672
|
+
* @return the newly created point object
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* var point1 = new Point(10, 100);
|
|
676
|
+
* var point2 = new Point(200, 5);
|
|
677
|
+
* var maxPoint = Point.max(point1, point2);
|
|
678
|
+
* console.log(maxPoint); // {x: 200, y: 100}
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* // Find the maximum of multiple points:
|
|
682
|
+
* var point1 = new Point(60, 100);
|
|
683
|
+
* var point2 = new Point(200, 5);
|
|
684
|
+
* var point3 = new Point(250, 35);
|
|
685
|
+
* [point1, point2, point3].reduce(Point.max) // {x: 250, y: 100}
|
|
686
|
+
*/
|
|
687
|
+
static max(point1: PointLike, point2: PointLike): Point;
|
|
688
|
+
/**
|
|
689
|
+
* Returns a point object with random {@link #x} and {@link #y} values
|
|
690
|
+
* between `0` and `1`.
|
|
691
|
+
*
|
|
692
|
+
* @return the newly created point object
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* var maxPoint = new Point(100, 100);
|
|
696
|
+
* var randomPoint = Point.random();
|
|
697
|
+
*
|
|
698
|
+
* // A point between {x:0, y:0} and {x:100, y:100}:
|
|
699
|
+
* var point = maxPoint * randomPoint;
|
|
700
|
+
*/
|
|
701
|
+
static random(): Point;
|
|
702
|
+
static isCollinear(x1: number, y1: number, x2: number, y2: number): boolean;
|
|
703
|
+
static isOrthogonal(x1: number, y1: number, x2: number, y2: number): boolean;
|
|
704
|
+
/**
|
|
705
|
+
* {@grouptitle Math Functions}
|
|
706
|
+
*
|
|
707
|
+
* Returns a new point with rounded {@link #x} and {@link #y} values. The
|
|
708
|
+
* object itself is not modified!
|
|
709
|
+
*
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* var point = new Point(10.2, 10.9);
|
|
713
|
+
* var roundPoint = point.round();
|
|
714
|
+
* console.log(roundPoint); // {x: 10, y: 11}
|
|
715
|
+
*/
|
|
716
|
+
round(): Point;
|
|
717
|
+
/**
|
|
718
|
+
* Returns a new point with the nearest greater non-fractional values to the
|
|
719
|
+
* specified {@link #x} and {@link #y} values. The object itself is not
|
|
720
|
+
* modified!
|
|
721
|
+
*
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* var point = new Point(10.2, 10.9);
|
|
725
|
+
* var ceilPoint = point.ceil();
|
|
726
|
+
* console.log(ceilPoint); // {x: 11, y: 11}
|
|
727
|
+
*/
|
|
728
|
+
ceil(): Point;
|
|
729
|
+
/**
|
|
730
|
+
* Returns a new point with the nearest smaller non-fractional values to the
|
|
731
|
+
* specified {@link #x} and {@link #y} values. The object itself is not
|
|
732
|
+
* modified!
|
|
733
|
+
*
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* var point = new Point(10.2, 10.9);
|
|
737
|
+
* var floorPoint = point.floor();
|
|
738
|
+
* console.log(floorPoint); // {x: 10, y: 10}
|
|
739
|
+
*/
|
|
740
|
+
floor(): Point;
|
|
741
|
+
/**
|
|
742
|
+
* Returns a new point with the absolute values of the specified {@link #x}
|
|
743
|
+
* and {@link #y} values. The object itself is not modified!
|
|
744
|
+
*
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* var point = new Point(-5, 10);
|
|
748
|
+
* var absPoint = point.abs();
|
|
749
|
+
* console.log(absPoint); // {x: 5, y: 10}
|
|
750
|
+
*/
|
|
751
|
+
abs(): Point;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* A point that belongs to an item, a segment or a curve, as
|
|
755
|
+
* {@link Item#position}, {@link Segment#point} and {@link Curve#point1} return
|
|
756
|
+
* it, which can be selected.
|
|
757
|
+
*/
|
|
758
|
+
export interface SelectablePoint extends Point {
|
|
759
|
+
/**
|
|
760
|
+
* Specifies whether the point is to appear as selected.
|
|
761
|
+
*
|
|
762
|
+
* Paper.js renders selected points on top of your project. This is very
|
|
763
|
+
* useful when debugging.
|
|
764
|
+
*
|
|
765
|
+
* @default false
|
|
766
|
+
*
|
|
767
|
+
* @example {@paperscript}
|
|
768
|
+
* var path = Path.circle({
|
|
769
|
+
* center: [80, 50],
|
|
770
|
+
* radius: 40
|
|
771
|
+
* });
|
|
772
|
+
*
|
|
773
|
+
* // Select the third segment point:
|
|
774
|
+
* path.segments[2].point.selected = true;
|
|
775
|
+
*
|
|
776
|
+
* // Select the item's position, which is the pivot point
|
|
777
|
+
* // around which it is transformed:
|
|
778
|
+
* path.position.selected = true;
|
|
779
|
+
*/
|
|
780
|
+
selected: boolean;
|
|
781
|
+
}
|