paper 0.17.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 +199 -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 +32941 -26371
- package/dist/paper-full.min.js +36 -31
- package/dist/paper-hosted.js +33623 -27236
- 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 +89 -59
- 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 -27591
- package/dist/docs/classes/AreaText.html +0 -9186
- package/dist/docs/classes/ChangeFlag.html +0 -385
- package/dist/docs/classes/Color.html +0 -2402
- package/dist/docs/classes/CompoundPath.html +0 -10018
- package/dist/docs/classes/Curve.html +0 -2326
- package/dist/docs/classes/CurveLocation.html +0 -673
- package/dist/docs/classes/DrawEvent.html +0 -69
- package/dist/docs/classes/Effect.html +0 -434
- package/dist/docs/classes/EffectInstance.html +0 -304
- 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 -7688
- package/dist/docs/classes/HitResult.html +0 -241
- package/dist/docs/classes/HostItem.html +0 -7314
- package/dist/docs/classes/Item.html +0 -7427
- package/dist/docs/classes/Key.html +0 -140
- package/dist/docs/classes/KeyEvent.html +0 -309
- package/dist/docs/classes/Layer.html +0 -7671
- 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 -204
- package/dist/docs/classes/Path.html +0 -13007
- package/dist/docs/classes/PathItem.html +0 -9780
- package/dist/docs/classes/PathText.html +0 -9056
- package/dist/docs/classes/PatternDefinition.html +0 -367
- package/dist/docs/classes/Point.html +0 -2860
- package/dist/docs/classes/PointText.html +0 -8967
- package/dist/docs/classes/Project.html +0 -1774
- package/dist/docs/classes/Raster.html +0 -8547
- package/dist/docs/classes/Rectangle.html +0 -1698
- package/dist/docs/classes/Segment.html +0 -1017
- package/dist/docs/classes/Shape.html +0 -8048
- package/dist/docs/classes/Size.html +0 -1915
- package/dist/docs/classes/StrokeProfileStop.html +0 -346
- package/dist/docs/classes/Style.html +0 -1765
- package/dist/docs/classes/SymbolDefinition.html +0 -338
- package/dist/docs/classes/SymbolItem.html +0 -7477
- package/dist/docs/classes/TextItem.html +0 -8810
- 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/browser.js +0 -15
- 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 -25636
- package/dist/paper-core.min.js +0 -32
- package/dist/paper.d.ts +0 -10481
- 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/LiveEffects.html +0 -366
- package/examples/Paperjs.org/MetaBalls.html +0 -132
- package/examples/Paperjs.org/NyanRainbow.html +0 -202
- package/examples/Paperjs.org/Offsetting.html +0 -379
- 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/StrokeProfiles.html +0 -706
- 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/Patterns.html +0 -57
- 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,550 @@
|
|
|
1
|
+
import { Formatter } from '../util/Formatter.ts';
|
|
2
|
+
import { Base } from '../core/Base.ts';
|
|
3
|
+
import { Point } from './Point.ts';
|
|
4
|
+
import { Size } from './Size.ts';
|
|
5
|
+
import type { PointLike } from './Point.ts';
|
|
6
|
+
import type { SizeLike } from './Size.ts';
|
|
7
|
+
/**
|
|
8
|
+
* What a rectangle can be passed as, where a function takes one.
|
|
9
|
+
*/
|
|
10
|
+
export type RectangleLike = Rectangle | number[] | {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
} | {
|
|
16
|
+
point: PointLike;
|
|
17
|
+
size: SizeLike;
|
|
18
|
+
} | {
|
|
19
|
+
from: PointLike;
|
|
20
|
+
to: PointLike;
|
|
21
|
+
} | {
|
|
22
|
+
[key: string]: number | PointLike | SizeLike;
|
|
23
|
+
};
|
|
24
|
+
export declare const corners: {
|
|
25
|
+
topLeft: number[];
|
|
26
|
+
topRight: number[];
|
|
27
|
+
bottomLeft: number[];
|
|
28
|
+
bottomRight: number[];
|
|
29
|
+
leftCenter: number[];
|
|
30
|
+
topCenter: number[];
|
|
31
|
+
rightCenter: number[];
|
|
32
|
+
bottomCenter: number[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A Rectangle specifies an area that is enclosed by its top-left point (x,
|
|
36
|
+
* y), its width, and its height. It should not be confused with a rectangular
|
|
37
|
+
* path, it is not an item.
|
|
38
|
+
*
|
|
39
|
+
* Wherever a rectangle is the only argument of a function, it can also be
|
|
40
|
+
* passed in any of the forms that the {@link Rectangle()} constructors take,
|
|
41
|
+
* e.g. `rect.unite(0, 0, 10, 10)`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class Rectangle extends Base {
|
|
44
|
+
#private;
|
|
45
|
+
/**
|
|
46
|
+
* The x position of the rectangle.
|
|
47
|
+
*/
|
|
48
|
+
x: number;
|
|
49
|
+
/**
|
|
50
|
+
* The y position of the rectangle.
|
|
51
|
+
*/
|
|
52
|
+
y: number;
|
|
53
|
+
/**
|
|
54
|
+
* The width of the rectangle.
|
|
55
|
+
*/
|
|
56
|
+
width: number;
|
|
57
|
+
/**
|
|
58
|
+
* The height of the rectangle.
|
|
59
|
+
*/
|
|
60
|
+
height: number;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a Rectangle object.
|
|
63
|
+
*
|
|
64
|
+
* @param point the top-left point of the rectangle
|
|
65
|
+
* @param size the size of the rectangle
|
|
66
|
+
*/
|
|
67
|
+
constructor(point: PointLike, size: SizeLike);
|
|
68
|
+
/**
|
|
69
|
+
* Creates a Rectangle object.
|
|
70
|
+
*
|
|
71
|
+
* @param object an object containing properties to be set on the
|
|
72
|
+
* rectangle
|
|
73
|
+
*
|
|
74
|
+
* @example // Create a rectangle between {x: 20, y: 20} and {x: 80, y:80}
|
|
75
|
+
* var rectangle = new Rectangle({
|
|
76
|
+
* point: [20, 20],
|
|
77
|
+
* size: [60, 60]
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @example // Create a rectangle between {x: 20, y: 20} and {x: 80, y:80}
|
|
81
|
+
* var rectangle = new Rectangle({
|
|
82
|
+
* from: [20, 20],
|
|
83
|
+
* to: [80, 80]
|
|
84
|
+
* });
|
|
85
|
+
*/
|
|
86
|
+
constructor(object: Exclude<RectangleLike, Rectangle | number[]>);
|
|
87
|
+
/**
|
|
88
|
+
* Creates a rectangle object.
|
|
89
|
+
*
|
|
90
|
+
* @param x the left coordinate
|
|
91
|
+
* @param y the top coordinate
|
|
92
|
+
* @param width
|
|
93
|
+
* @param height
|
|
94
|
+
*/
|
|
95
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
96
|
+
/**
|
|
97
|
+
* Creates a rectangle object from the passed points. These do not
|
|
98
|
+
* necessarily need to be the top left and bottom right corners, the
|
|
99
|
+
* constructor figures out how to fit a rectangle between them.
|
|
100
|
+
*
|
|
101
|
+
* @param from the first point defining the rectangle
|
|
102
|
+
* @param to the second point defining the rectangle
|
|
103
|
+
*/
|
|
104
|
+
constructor(from: PointLike, to: PointLike);
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new rectangle object from the passed rectangle object.
|
|
107
|
+
*
|
|
108
|
+
* @param rectangle
|
|
109
|
+
*/
|
|
110
|
+
constructor(rectangle?: Rectangle);
|
|
111
|
+
constructor(rect: RectangleLike | PointLike | number, y?: PointLike | SizeLike | number, width?: number, height?: number);
|
|
112
|
+
/**
|
|
113
|
+
* Sets the rectangle to the passed values. Note that any sequence of
|
|
114
|
+
* parameters that is supported by the various {@link Rectangle()}
|
|
115
|
+
* constructors also work for calls of `set()`.
|
|
116
|
+
*
|
|
117
|
+
* @param rect the rectangle, its point or `from`, or its x-coordinate
|
|
118
|
+
* @param y its size, `to` or y-coordinate
|
|
119
|
+
* @param width its width, with numbers as the first arguments
|
|
120
|
+
* @param height its height, with numbers as the first arguments
|
|
121
|
+
*/
|
|
122
|
+
set(rect?: RectangleLike | PointLike | number, y?: PointLike | SizeLike | number, width?: number, height?: number): this;
|
|
123
|
+
_set(x: number, y: number, width: number, height: number): this;
|
|
124
|
+
/**
|
|
125
|
+
* Returns a copy of the rectangle.
|
|
126
|
+
*/
|
|
127
|
+
clone(): Rectangle;
|
|
128
|
+
/**
|
|
129
|
+
* Checks whether the coordinates and size of the rectangle are equal to
|
|
130
|
+
* that of the supplied rectangle.
|
|
131
|
+
*
|
|
132
|
+
* @param rect
|
|
133
|
+
* @return {@true if the rectangles are equal}
|
|
134
|
+
*/
|
|
135
|
+
equals(rect: RectangleLike | null | undefined): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* @return a string representation of this rectangle
|
|
138
|
+
*/
|
|
139
|
+
toString(): string;
|
|
140
|
+
_serialize(options: {
|
|
141
|
+
formatter: Formatter;
|
|
142
|
+
}): number[];
|
|
143
|
+
/**
|
|
144
|
+
* The rectangle's position and size as an array,
|
|
145
|
+
* `[x, y, width, height]`, as {@link Matrix#values} gives those of a
|
|
146
|
+
* matrix.
|
|
147
|
+
*/
|
|
148
|
+
get values(): number[];
|
|
149
|
+
/**
|
|
150
|
+
* The top-left point of the rectangle. Setting it moves the whole
|
|
151
|
+
* rectangle, unlike {@link #topLeft}.
|
|
152
|
+
*/
|
|
153
|
+
get point(): Point;
|
|
154
|
+
set point(point: PointLike);
|
|
155
|
+
/**
|
|
156
|
+
* The size of the rectangle
|
|
157
|
+
*/
|
|
158
|
+
get size(): Size;
|
|
159
|
+
set size(size: SizeLike);
|
|
160
|
+
/**
|
|
161
|
+
* {@grouptitle Side Positions}
|
|
162
|
+
*
|
|
163
|
+
* The position of the left hand side of the rectangle. Note that this
|
|
164
|
+
* doesn't move the whole rectangle; the right hand side stays where it was.
|
|
165
|
+
*/
|
|
166
|
+
get left(): number;
|
|
167
|
+
set left(left: number);
|
|
168
|
+
/**
|
|
169
|
+
* The top coordinate of the rectangle. Note that this doesn't move the
|
|
170
|
+
* whole rectangle: the bottom won't move.
|
|
171
|
+
*/
|
|
172
|
+
get top(): number;
|
|
173
|
+
set top(top: number);
|
|
174
|
+
/**
|
|
175
|
+
* The position of the right hand side of the rectangle. Note that this
|
|
176
|
+
* doesn't move the whole rectangle; the left hand side stays where it was.
|
|
177
|
+
*/
|
|
178
|
+
get right(): number;
|
|
179
|
+
set right(right: number);
|
|
180
|
+
/**
|
|
181
|
+
* The bottom coordinate of the rectangle. Note that this doesn't move the
|
|
182
|
+
* whole rectangle: the top won't move.
|
|
183
|
+
*/
|
|
184
|
+
get bottom(): number;
|
|
185
|
+
set bottom(bottom: number);
|
|
186
|
+
/**
|
|
187
|
+
* {@grouptitle Corner and Center Point Positions}
|
|
188
|
+
*
|
|
189
|
+
* The center point of the rectangle. Setting it moves the whole rectangle.
|
|
190
|
+
*/
|
|
191
|
+
get center(): Point;
|
|
192
|
+
set center(point: PointLike);
|
|
193
|
+
/**
|
|
194
|
+
* The area of the rectangle.
|
|
195
|
+
*/
|
|
196
|
+
get area(): number;
|
|
197
|
+
/**
|
|
198
|
+
* @return {@true if the rectangle is empty}
|
|
199
|
+
*/
|
|
200
|
+
isEmpty(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* {@grouptitle Geometric Tests}
|
|
203
|
+
*
|
|
204
|
+
* Tests if the specified point is inside the boundary of the rectangle.
|
|
205
|
+
*
|
|
206
|
+
* @param point the specified point
|
|
207
|
+
* @return {@true if the point is inside the rectangle's boundary}
|
|
208
|
+
*
|
|
209
|
+
* @example {@paperscript}
|
|
210
|
+
* // Checking whether the mouse position falls within the bounding
|
|
211
|
+
* // rectangle of an item:
|
|
212
|
+
*
|
|
213
|
+
* // Create a circle shaped path at {x: 80, y: 50}
|
|
214
|
+
* // with a radius of 30.
|
|
215
|
+
* var circle = Path.circle(new Point(80, 50), 30);
|
|
216
|
+
* circle.fillColor = 'red';
|
|
217
|
+
*
|
|
218
|
+
* function onMouseMove(event) {
|
|
219
|
+
* // Check whether the mouse position intersects with the
|
|
220
|
+
* // bounding box of the item:
|
|
221
|
+
* if (circle.bounds.contains(event.point)) {
|
|
222
|
+
* // If it intersects, fill it with green:
|
|
223
|
+
* circle.fillColor = 'green';
|
|
224
|
+
* } else {
|
|
225
|
+
* // If it doesn't intersect, fill it with red:
|
|
226
|
+
* circle.fillColor = 'red';
|
|
227
|
+
* }
|
|
228
|
+
* }
|
|
229
|
+
*/
|
|
230
|
+
contains(point: PointLike | number, y?: number): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Tests if the interior of the rectangle entirely contains the specified
|
|
233
|
+
* rectangle.
|
|
234
|
+
*
|
|
235
|
+
* @param rect the specified rectangle
|
|
236
|
+
* @return {@true if the rectangle entirely contains the specified
|
|
237
|
+
* rectangle}
|
|
238
|
+
*
|
|
239
|
+
* @example {@paperscript}
|
|
240
|
+
* // Checking whether the bounding box of one item is contained within
|
|
241
|
+
* // that of another item:
|
|
242
|
+
*
|
|
243
|
+
* // All newly created paths will inherit these styles:
|
|
244
|
+
* project.currentStyle = {
|
|
245
|
+
* fillColor: 'green',
|
|
246
|
+
* strokeColor: 'black'
|
|
247
|
+
* };
|
|
248
|
+
*
|
|
249
|
+
* // Create a circle shaped path at {x: 80, y: 50}
|
|
250
|
+
* // with a radius of 45.
|
|
251
|
+
* var largeCircle = Path.circle(new Point(80, 50), 45);
|
|
252
|
+
*
|
|
253
|
+
* // Create a smaller circle shaped path in the same position
|
|
254
|
+
* // with a radius of 30.
|
|
255
|
+
* var circle = Path.circle(new Point(80, 50), 30);
|
|
256
|
+
*
|
|
257
|
+
* function onMouseMove(event) {
|
|
258
|
+
* // Move the circle to the position of the mouse:
|
|
259
|
+
* circle.position = event.point;
|
|
260
|
+
*
|
|
261
|
+
* // Check whether the bounding box of the smaller circle
|
|
262
|
+
* // is contained within the bounding box of the larger item:
|
|
263
|
+
* if (largeCircle.bounds.contains(circle.bounds)) {
|
|
264
|
+
* // If it does, fill it with green:
|
|
265
|
+
* circle.fillColor = 'green';
|
|
266
|
+
* largeCircle.fillColor = 'green';
|
|
267
|
+
* } else {
|
|
268
|
+
* // If doesn't, fill it with red:
|
|
269
|
+
* circle.fillColor = 'red';
|
|
270
|
+
* largeCircle.fillColor = 'red';
|
|
271
|
+
* }
|
|
272
|
+
* }
|
|
273
|
+
*/
|
|
274
|
+
contains(rect: RectangleLike | number, y?: number, width?: number, height?: number): boolean;
|
|
275
|
+
_containsPoint(point: Point): boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Tests if the interior of this rectangle intersects the interior of
|
|
278
|
+
* another rectangle. Rectangles just touching each other are considered as
|
|
279
|
+
* non-intersecting, except if a `epsilon` value is specified by which this
|
|
280
|
+
* rectangle's dimensions are increased before comparing.
|
|
281
|
+
*
|
|
282
|
+
* @param rect the specified rectangle
|
|
283
|
+
* @param epsilon the epsilon against which to compare the
|
|
284
|
+
* rectangle's dimensions
|
|
285
|
+
* @return {@true if the rectangle and the specified rectangle
|
|
286
|
+
* intersect each other}
|
|
287
|
+
*
|
|
288
|
+
* @example {@paperscript}
|
|
289
|
+
* // Checking whether the bounding box of one item intersects with
|
|
290
|
+
* // that of another item:
|
|
291
|
+
*
|
|
292
|
+
* // All newly created paths will inherit these styles:
|
|
293
|
+
* project.currentStyle = {
|
|
294
|
+
* fillColor: 'green',
|
|
295
|
+
* strokeColor: 'black'
|
|
296
|
+
* };
|
|
297
|
+
*
|
|
298
|
+
* // Create a circle shaped path at {x: 80, y: 50}
|
|
299
|
+
* // with a radius of 45.
|
|
300
|
+
* var largeCircle = Path.circle(new Point(80, 50), 45);
|
|
301
|
+
*
|
|
302
|
+
* // Create a smaller circle shaped path in the same position
|
|
303
|
+
* // with a radius of 30.
|
|
304
|
+
* var circle = Path.circle(new Point(80, 50), 30);
|
|
305
|
+
*
|
|
306
|
+
* function onMouseMove(event) {
|
|
307
|
+
* // Move the circle to the position of the mouse:
|
|
308
|
+
* circle.position = event.point;
|
|
309
|
+
*
|
|
310
|
+
* // Check whether the bounding box of the two circle
|
|
311
|
+
* // shaped paths intersect:
|
|
312
|
+
* if (largeCircle.bounds.intersects(circle.bounds)) {
|
|
313
|
+
* // If it does, fill it with green:
|
|
314
|
+
* circle.fillColor = 'green';
|
|
315
|
+
* largeCircle.fillColor = 'green';
|
|
316
|
+
* } else {
|
|
317
|
+
* // If doesn't, fill it with red:
|
|
318
|
+
* circle.fillColor = 'red';
|
|
319
|
+
* largeCircle.fillColor = 'red';
|
|
320
|
+
* }
|
|
321
|
+
* }
|
|
322
|
+
*/
|
|
323
|
+
intersects(rect: RectangleLike, epsilon?: number): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* {@grouptitle Boolean Operations}
|
|
326
|
+
*
|
|
327
|
+
* Returns a new rectangle representing the intersection of this rectangle
|
|
328
|
+
* with the specified rectangle.
|
|
329
|
+
*
|
|
330
|
+
* @param rect the rectangle to be intersected with this
|
|
331
|
+
* rectangle
|
|
332
|
+
* @return the largest rectangle contained in both the specified
|
|
333
|
+
* rectangle and in this rectangle
|
|
334
|
+
*
|
|
335
|
+
* @example {@paperscript}
|
|
336
|
+
* // Intersecting two rectangles and visualizing the result using rectangle
|
|
337
|
+
* // shaped paths:
|
|
338
|
+
*
|
|
339
|
+
* // Create two rectangles that overlap each other
|
|
340
|
+
* var size = new Size(50, 50);
|
|
341
|
+
* var rectangle1 = new Rectangle(new Point(25, 15), size);
|
|
342
|
+
* var rectangle2 = new Rectangle(new Point(50, 40), size);
|
|
343
|
+
*
|
|
344
|
+
* // The rectangle that represents the intersection of the
|
|
345
|
+
* // two rectangles:
|
|
346
|
+
* var intersected = rectangle1.intersect(rectangle2);
|
|
347
|
+
*
|
|
348
|
+
* // To visualize the intersecting of the rectangles, we will
|
|
349
|
+
* // create rectangle shaped paths using Path.rectangle()
|
|
350
|
+
* // constructor.
|
|
351
|
+
*
|
|
352
|
+
* // Have all newly created paths inherit a black stroke:
|
|
353
|
+
* project.currentStyle.strokeColor = 'black';
|
|
354
|
+
*
|
|
355
|
+
* // Create two rectangle shaped paths using the abstract rectangles
|
|
356
|
+
* // we created before:
|
|
357
|
+
* Path.rectangle(rectangle1);
|
|
358
|
+
* Path.rectangle(rectangle2);
|
|
359
|
+
*
|
|
360
|
+
* // Create a path that represents the intersected rectangle,
|
|
361
|
+
* // and fill it with red:
|
|
362
|
+
* var intersectionPath = Path.rectangle(intersected);
|
|
363
|
+
* intersectionPath.fillColor = 'red';
|
|
364
|
+
*/
|
|
365
|
+
intersect(rect: RectangleLike | PointLike | number, y?: PointLike | SizeLike | number, width?: number, height?: number): Rectangle;
|
|
366
|
+
/**
|
|
367
|
+
* Returns a new rectangle representing the union of this rectangle with the
|
|
368
|
+
* specified rectangle.
|
|
369
|
+
*
|
|
370
|
+
* @param rect the rectangle to be combined with this rectangle
|
|
371
|
+
* @return the smallest rectangle containing both the specified
|
|
372
|
+
* rectangle and this rectangle
|
|
373
|
+
*/
|
|
374
|
+
unite(rect: RectangleLike | PointLike | number, y?: PointLike | SizeLike | number, width?: number, height?: number): Rectangle;
|
|
375
|
+
/**
|
|
376
|
+
* Adds a point to this rectangle. The resulting rectangle is the smallest
|
|
377
|
+
* rectangle that contains both the original rectangle and the specified
|
|
378
|
+
* point.
|
|
379
|
+
*
|
|
380
|
+
* After adding a point, a call to {@link #contains(point)} with the added
|
|
381
|
+
* point as an argument does not necessarily return `true`. The {@link
|
|
382
|
+
* Rectangle#contains(point)} method does not return `true` for points on
|
|
383
|
+
* the right or bottom edges of a rectangle. Therefore, if the added point
|
|
384
|
+
* falls on the left or bottom edge of the enlarged rectangle, {@link
|
|
385
|
+
* Rectangle#contains(point)} returns `false` for that point.
|
|
386
|
+
*
|
|
387
|
+
* @param point
|
|
388
|
+
* @return the smallest rectangle that contains both the
|
|
389
|
+
* original rectangle and the specified point
|
|
390
|
+
*/
|
|
391
|
+
include(point: PointLike | number, y?: number): Rectangle;
|
|
392
|
+
/**
|
|
393
|
+
* Returns a new rectangle expanded by the specified amount in horizontal
|
|
394
|
+
* and vertical directions.
|
|
395
|
+
*
|
|
396
|
+
* @param amount the amount to expand the rectangle in
|
|
397
|
+
* both directions
|
|
398
|
+
* @return the expanded rectangle
|
|
399
|
+
*/
|
|
400
|
+
expand(amount: SizeLike | number): Rectangle;
|
|
401
|
+
/**
|
|
402
|
+
* Returns a new rectangle expanded by the specified amounts in horizontal
|
|
403
|
+
* and vertical directions.
|
|
404
|
+
*
|
|
405
|
+
* @param hor the amount to expand the rectangle in horizontal
|
|
406
|
+
* direction
|
|
407
|
+
* @param ver the amount to expand the rectangle in vertical
|
|
408
|
+
* direction
|
|
409
|
+
* @return the expanded rectangle
|
|
410
|
+
*/
|
|
411
|
+
expand(hor: number, ver: number): Rectangle;
|
|
412
|
+
/**
|
|
413
|
+
* Returns a new rectangle scaled by the specified factor from its center,
|
|
414
|
+
* or from the given center point.
|
|
415
|
+
*
|
|
416
|
+
* @param scale the scale factor
|
|
417
|
+
* @param center
|
|
418
|
+
* @return the scaled rectangle
|
|
419
|
+
*/
|
|
420
|
+
scale(scale: PointLike | number, center?: PointLike): Rectangle;
|
|
421
|
+
/**
|
|
422
|
+
* Returns a new rectangle scaled in horizontal direction by the specified
|
|
423
|
+
* `hor` factor and in vertical direction by the specified `ver` factor
|
|
424
|
+
* from its center, or from the given center point.
|
|
425
|
+
*
|
|
426
|
+
* @param hor the horizontal scale factor
|
|
427
|
+
* @param ver the vertical scale factor
|
|
428
|
+
* @param center
|
|
429
|
+
* @return the scaled rectangle
|
|
430
|
+
*/
|
|
431
|
+
scale(hor: number, ver: number, center?: PointLike): Rectangle;
|
|
432
|
+
/**
|
|
433
|
+
* Returns the passed rectangle if it is one already, or else a new
|
|
434
|
+
* rectangle created from the passed values, as {@link Rectangle()} reads
|
|
435
|
+
* them.
|
|
436
|
+
*
|
|
437
|
+
* @param rect
|
|
438
|
+
* @param y
|
|
439
|
+
* @param width
|
|
440
|
+
* @param height
|
|
441
|
+
*/
|
|
442
|
+
static from(rect: RectangleLike | PointLike | number, y?: PointLike | SizeLike | number, width?: number, height?: number): Rectangle;
|
|
443
|
+
/**
|
|
444
|
+
* The top-left point of the rectangle. Note that this doesn't move the
|
|
445
|
+
* whole rectangle; the bottom-right corner stays where it was.
|
|
446
|
+
*/
|
|
447
|
+
get topLeft(): Point;
|
|
448
|
+
set topLeft(point: PointLike);
|
|
449
|
+
/**
|
|
450
|
+
* The top-right point of the rectangle. Note that this doesn't move the
|
|
451
|
+
* whole rectangle; the bottom-left corner stays where it was.
|
|
452
|
+
*/
|
|
453
|
+
get topRight(): Point;
|
|
454
|
+
set topRight(point: PointLike);
|
|
455
|
+
/**
|
|
456
|
+
* The bottom-left point of the rectangle. Note that this doesn't move the
|
|
457
|
+
* whole rectangle; the top-right corner stays where it was.
|
|
458
|
+
*/
|
|
459
|
+
get bottomLeft(): Point;
|
|
460
|
+
set bottomLeft(point: PointLike);
|
|
461
|
+
/**
|
|
462
|
+
* The bottom-right point of the rectangle. Note that this doesn't move the
|
|
463
|
+
* whole rectangle; the top-left corner stays where it was.
|
|
464
|
+
*/
|
|
465
|
+
get bottomRight(): Point;
|
|
466
|
+
set bottomRight(point: PointLike);
|
|
467
|
+
/**
|
|
468
|
+
* The left-center point of the rectangle. Setting it moves the left hand
|
|
469
|
+
* side while the right hand side stays where it was, and moves the whole
|
|
470
|
+
* rectangle vertically.
|
|
471
|
+
*/
|
|
472
|
+
get leftCenter(): Point;
|
|
473
|
+
set leftCenter(point: PointLike);
|
|
474
|
+
/**
|
|
475
|
+
* The top-center point of the rectangle. Setting it moves the top while
|
|
476
|
+
* the bottom stays where it was, and moves the whole rectangle
|
|
477
|
+
* horizontally.
|
|
478
|
+
*/
|
|
479
|
+
get topCenter(): Point;
|
|
480
|
+
set topCenter(point: PointLike);
|
|
481
|
+
/**
|
|
482
|
+
* The right-center point of the rectangle. Setting it moves the right
|
|
483
|
+
* hand side while the left hand side stays where it was, and moves the
|
|
484
|
+
* whole rectangle vertically.
|
|
485
|
+
*/
|
|
486
|
+
get rightCenter(): Point;
|
|
487
|
+
set rightCenter(point: PointLike);
|
|
488
|
+
/**
|
|
489
|
+
* The bottom-center point of the rectangle. Setting it moves the bottom
|
|
490
|
+
* while the top stays where it was, and moves the whole rectangle
|
|
491
|
+
* horizontally.
|
|
492
|
+
*/
|
|
493
|
+
get bottomCenter(): Point;
|
|
494
|
+
set bottomCenter(point: PointLike);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The bounds of an item, as {@link Item#bounds} and {@link Item#strokeBounds}
|
|
498
|
+
* return them, which can be selected.
|
|
499
|
+
*/
|
|
500
|
+
export interface SelectableRectangle extends Rectangle {
|
|
501
|
+
/**
|
|
502
|
+
* Specifies whether the item's bounds are to appear as selected.
|
|
503
|
+
*
|
|
504
|
+
* Paper.js draws the bounds of items with selected bounds on top of
|
|
505
|
+
* your project. This is very useful when debugging. {@link Item#bounds}
|
|
506
|
+
* and {@link Item#strokeBounds} are selected independently of each other,
|
|
507
|
+
* each showing its own bounds.
|
|
508
|
+
*
|
|
509
|
+
* @default false
|
|
510
|
+
*
|
|
511
|
+
* @example {@paperscript}
|
|
512
|
+
* var path = Path.circle({
|
|
513
|
+
* center: [80, 50],
|
|
514
|
+
* radius: 40,
|
|
515
|
+
* selected: true
|
|
516
|
+
* });
|
|
517
|
+
*
|
|
518
|
+
* path.bounds.selected = true;
|
|
519
|
+
*/
|
|
520
|
+
selected: boolean;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Tells whether the first of several arguments describes a rectangle, rather
|
|
524
|
+
* than the point of (point, size) or (from, to): an array of four values, or
|
|
525
|
+
* an object with both `x` and `width`.
|
|
526
|
+
*
|
|
527
|
+
* @private
|
|
528
|
+
*/
|
|
529
|
+
export declare function isRectangle(value: any): boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Reads the rectangle that a named object describes, through its `rectangle`
|
|
532
|
+
* or through any of the rectangle's properties, and returns it with the
|
|
533
|
+
* object's other properties, for set(), as the Path and Shape factories use it.
|
|
534
|
+
*
|
|
535
|
+
* @private
|
|
536
|
+
*/
|
|
537
|
+
export declare function readRectangle(object: Record<string, any>): [Rectangle, Record<string, any>];
|
|
538
|
+
/**
|
|
539
|
+
* Reads the center and radius of an ellipse from a named object, either from
|
|
540
|
+
* its `center` and `radius`, or from the rectangle that it describes, see
|
|
541
|
+
* readRectangle(), and returns them with the object's other properties, for
|
|
542
|
+
* set(), as the Path and Shape factories use it.
|
|
543
|
+
*
|
|
544
|
+
* @private
|
|
545
|
+
*/
|
|
546
|
+
export declare function readEllipse(object: Record<string, any>): {
|
|
547
|
+
center: Point;
|
|
548
|
+
radius: Size;
|
|
549
|
+
props: Record<string, any>;
|
|
550
|
+
};
|