plotboilerplate 1.27.1 → 1.28.0
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/dist/index.esm.js +135 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +96 -17
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +2 -1
- package/src/_cjs/BezierPath.d.ts +610 -0
- package/src/_cjs/BezierPath.js +1127 -0
- package/src/_cjs/BezierPath.js.map +1 -0
- package/src/_cjs/Bounds.d.ts +252 -0
- package/src/_cjs/Bounds.js +320 -0
- package/src/_cjs/Bounds.js.map +1 -0
- package/src/_cjs/Circle.d.ts +214 -0
- package/src/_cjs/Circle.js +339 -0
- package/src/_cjs/Circle.js.map +1 -0
- package/src/_cjs/CircleSector.d.ts +211 -0
- package/src/_cjs/CircleSector.js +364 -0
- package/src/_cjs/CircleSector.js.map +1 -0
- package/src/_cjs/CubicBezierCurve.d.ts +656 -0
- package/src/_cjs/CubicBezierCurve.js +1062 -0
- package/src/_cjs/CubicBezierCurve.js.map +1 -0
- package/src/_cjs/Grid.d.ts +83 -0
- package/src/_cjs/Grid.js +90 -0
- package/src/_cjs/Grid.js.map +1 -0
- package/src/_cjs/KeyHandler.d.ts +177 -0
- package/src/_cjs/KeyHandler.js +435 -0
- package/src/_cjs/KeyHandler.js.map +1 -0
- package/src/_cjs/Line.d.ts +134 -0
- package/src/_cjs/Line.js +220 -0
- package/src/_cjs/Line.js.map +1 -0
- package/src/_cjs/MouseHandler.d.ts +283 -0
- package/src/_cjs/MouseHandler.js +423 -0
- package/src/_cjs/MouseHandler.js.map +1 -0
- package/src/_cjs/PBImage.d.ts +81 -0
- package/src/_cjs/PBImage.js +61 -0
- package/src/_cjs/PBImage.js.map +1 -0
- package/src/_cjs/PBText.d.ts +118 -0
- package/src/_cjs/PBText.js +63 -0
- package/src/_cjs/PBText.js.map +1 -0
- package/src/_cjs/PlotBoilerplate.d.ts +899 -0
- package/src/_cjs/PlotBoilerplate.js +2348 -0
- package/src/_cjs/PlotBoilerplate.js.map +1 -0
- package/src/_cjs/Polygon.d.ts +520 -0
- package/src/_cjs/Polygon.js +933 -0
- package/src/_cjs/Polygon.js.map +1 -0
- package/src/_cjs/SVGBuilder.d.ts +47 -0
- package/src/_cjs/SVGBuilder.js +100 -0
- package/src/_cjs/SVGBuilder.js.map +1 -0
- package/src/_cjs/Triangle.d.ts +392 -0
- package/src/_cjs/Triangle.js +497 -0
- package/src/_cjs/Triangle.js.map +1 -0
- package/src/_cjs/UIDGenerator.d.ts +12 -0
- package/src/_cjs/UIDGenerator.js +21 -0
- package/src/_cjs/UIDGenerator.js.map +1 -0
- package/src/_cjs/VEllipse.d.ts +319 -0
- package/src/_cjs/VEllipse.js +578 -0
- package/src/_cjs/VEllipse.js.map +1 -0
- package/src/_cjs/VEllipseSector.d.ts +230 -0
- package/src/_cjs/VEllipseSector.js +428 -0
- package/src/_cjs/VEllipseSector.js.map +1 -0
- package/src/_cjs/Vector.d.ts +126 -0
- package/src/_cjs/Vector.js +199 -0
- package/src/_cjs/Vector.js.map +1 -0
- package/src/_cjs/VertTuple.d.ts +284 -0
- package/src/_cjs/VertTuple.js +348 -0
- package/src/_cjs/VertTuple.js.map +1 -0
- package/src/_cjs/Vertex.d.ts +498 -0
- package/src/_cjs/Vertex.js +703 -0
- package/src/_cjs/Vertex.js.map +1 -0
- package/src/_cjs/VertexAttr.d.ts +72 -0
- package/src/_cjs/VertexAttr.js +59 -0
- package/src/_cjs/VertexAttr.js.map +1 -0
- package/src/_cjs/VertexListeners.d.ts +208 -0
- package/src/_cjs/VertexListeners.js +267 -0
- package/src/_cjs/VertexListeners.js.map +1 -0
- package/src/_cjs/draw.d.ts +657 -0
- package/src/_cjs/draw.js +1164 -0
- package/src/_cjs/draw.js.map +1 -0
- package/src/_cjs/drawgl.d.ts +544 -0
- package/src/_cjs/drawgl.js +794 -0
- package/src/_cjs/drawgl.js.map +1 -0
- package/src/_cjs/drawutilssvg.d.ts +954 -0
- package/src/_cjs/drawutilssvg.js +1713 -0
- package/src/_cjs/drawutilssvg.js.map +1 -0
- package/src/_cjs/entry-glsupport.js +28 -0
- package/src/_cjs/entry.js +29 -0
- package/src/_cjs/geomutils.d.ts +77 -0
- package/src/_cjs/geomutils.js +126 -0
- package/src/_cjs/geomutils.js.map +1 -0
- package/src/_cjs/index.d.ts +102 -0
- package/src/_cjs/index.js +128 -0
- package/src/_cjs/index.js.map +1 -0
- package/src/_cjs/interfaces/DrawLib.d.ts +582 -0
- package/src/_cjs/interfaces/DrawLib.js +32 -0
- package/src/_cjs/interfaces/DrawLib.js.map +1 -0
- package/src/_cjs/interfaces/additionals.d.ts +95 -0
- package/src/_cjs/interfaces/additionals.js +3 -0
- package/src/_cjs/interfaces/additionals.js.map +1 -0
- package/src/_cjs/interfaces/core.d.ts +286 -0
- package/src/_cjs/interfaces/core.js +30 -0
- package/src/_cjs/interfaces/core.js.map +1 -0
- package/src/_cjs/interfaces/externals.d.ts +56 -0
- package/src/_cjs/interfaces/externals.js +8 -0
- package/src/_cjs/interfaces/externals.js.map +1 -0
- package/src/_cjs/interfaces/index.d.ts +4 -0
- package/src/_cjs/interfaces/index.js +21 -0
- package/src/_cjs/interfaces/index.js.map +1 -0
- package/src/_cjs/module.d.ts +26 -0
- package/src/_cjs/module.js +60 -0
- package/src/_cjs/module.js.map +1 -0
- package/src/_cjs/utils/InitializationObserver.d.ts +18 -0
- package/src/_cjs/utils/InitializationObserver.js +63 -0
- package/src/_cjs/utils/InitializationObserver.js.map +1 -0
- package/src/_cjs/utils/LissajousFigure.d.ts +34 -0
- package/src/_cjs/utils/LissajousFigure.js +100 -0
- package/src/_cjs/utils/LissajousFigure.js.map +1 -0
- package/src/_cjs/utils/NGons.d.ts +13 -0
- package/src/_cjs/utils/NGons.js +36 -0
- package/src/_cjs/utils/NGons.js.map +1 -0
- package/src/_cjs/utils/Params.d.ts +17 -0
- package/src/_cjs/utils/Params.js +53 -0
- package/src/_cjs/utils/Params.js.map +1 -0
- package/src/_cjs/utils/PerlinNoise.d.ts +19 -0
- package/src/_cjs/utils/PerlinNoise.js +352 -0
- package/src/_cjs/utils/PerlinNoise.js.map +1 -0
- package/src/_cjs/utils/SVGPathUtils.d.ts +22 -0
- package/src/_cjs/utils/SVGPathUtils.js +45 -0
- package/src/_cjs/utils/SVGPathUtils.js.map +1 -0
- package/src/_cjs/utils/WebColors.d.ts +35 -0
- package/src/_cjs/utils/WebColors.js +58 -0
- package/src/_cjs/utils/WebColors.js.map +1 -0
- package/src/_cjs/utils/WebColorsContrast.d.ts +6 -0
- package/src/_cjs/utils/WebColorsContrast.js +12 -0
- package/src/_cjs/utils/WebColorsContrast.js.map +1 -0
- package/src/_cjs/utils/WebColorsMalachite.d.ts +12 -0
- package/src/_cjs/utils/WebColorsMalachite.js +28 -0
- package/src/_cjs/utils/WebColorsMalachite.js.map +1 -0
- package/src/_cjs/utils/algorithms/CatmullRomPath.d.ts +60 -0
- package/src/_cjs/utils/algorithms/CatmullRomPath.js +108 -0
- package/src/_cjs/utils/algorithms/CatmullRomPath.js.map +1 -0
- package/src/_cjs/utils/algorithms/CircleIntersections.d.ts +170 -0
- package/src/_cjs/utils/algorithms/CircleIntersections.js +310 -0
- package/src/_cjs/utils/algorithms/CircleIntersections.js.map +1 -0
- package/src/_cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
- package/src/_cjs/utils/algorithms/ContourLineDetection.js +367 -0
- package/src/_cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
- package/src/_cjs/utils/algorithms/CubicSplinePath.d.ts +63 -0
- package/src/_cjs/utils/algorithms/CubicSplinePath.js +175 -0
- package/src/_cjs/utils/algorithms/CubicSplinePath.js.map +1 -0
- package/src/_cjs/utils/algorithms/HobbyPath.d.ts +81 -0
- package/src/_cjs/utils/algorithms/HobbyPath.js +278 -0
- package/src/_cjs/utils/algorithms/HobbyPath.js.map +1 -0
- package/src/_cjs/utils/algorithms/Metaballs.d.ts +30 -0
- package/src/_cjs/utils/algorithms/Metaballs.js +114 -0
- package/src/_cjs/utils/algorithms/Metaballs.js.map +1 -0
- package/src/_cjs/utils/algorithms/PolygonInset.d.ts +184 -0
- package/src/_cjs/utils/algorithms/PolygonInset.js +431 -0
- package/src/_cjs/utils/algorithms/PolygonInset.js.map +1 -0
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js +269 -0
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/_cjs/utils/algorithms/arrayFill.d.ts +8 -0
- package/src/_cjs/utils/algorithms/arrayFill.js +18 -0
- package/src/_cjs/utils/algorithms/arrayFill.js.map +1 -0
- package/src/_cjs/utils/algorithms/arrayResize.d.ts +8 -0
- package/src/_cjs/utils/algorithms/arrayResize.js +24 -0
- package/src/_cjs/utils/algorithms/arrayResize.js.map +1 -0
- package/src/_cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/_cjs/utils/algorithms/arrayShuffle.js +15 -0
- package/src/_cjs/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.js +51 -0
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js +61 -0
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
- package/src/_cjs/utils/algorithms/convexHull.d.ts +23 -0
- package/src/_cjs/utils/algorithms/convexHull.js +71 -0
- package/src/_cjs/utils/algorithms/convexHull.js.map +1 -0
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.js +145 -0
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -0
- package/src/_cjs/utils/algorithms/delaunay.d.ts +30 -0
- package/src/_cjs/utils/algorithms/delaunay.js +158 -0
- package/src/_cjs/utils/algorithms/delaunay.js.map +1 -0
- package/src/_cjs/utils/algorithms/delaunay2voronoi.d.ts +25 -0
- package/src/_cjs/utils/algorithms/delaunay2voronoi.js +104 -0
- package/src/_cjs/utils/algorithms/delaunay2voronoi.js.map +1 -0
- package/src/_cjs/utils/algorithms/detectPaths.d.ts +21 -0
- package/src/_cjs/utils/algorithms/detectPaths.js +169 -0
- package/src/_cjs/utils/algorithms/detectPaths.js.map +1 -0
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js +51 -0
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
- package/src/_cjs/utils/algorithms/getContrastColor.d.ts +13 -0
- package/src/_cjs/utils/algorithms/getContrastColor.js +26 -0
- package/src/_cjs/utils/algorithms/getContrastColor.js.map +1 -0
- package/src/_cjs/utils/algorithms/matrixFill.d.ts +10 -0
- package/src/_cjs/utils/algorithms/matrixFill.js +21 -0
- package/src/_cjs/utils/algorithms/matrixFill.js.map +1 -0
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js +102 -0
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
- package/src/_cjs/utils/algorithms/sutherlandHodgman.d.ts +16 -0
- package/src/_cjs/utils/algorithms/sutherlandHodgman.js +76 -0
- package/src/_cjs/utils/algorithms/sutherlandHodgman.js.map +1 -0
- package/src/_cjs/utils/cloneVertexArray.d.ts +13 -0
- package/src/_cjs/utils/cloneVertexArray.js +23 -0
- package/src/_cjs/utils/cloneVertexArray.js.map +1 -0
- package/src/_cjs/utils/createRandomizedPolygon.d.ts +14 -0
- package/src/_cjs/utils/createRandomizedPolygon.js +32 -0
- package/src/_cjs/utils/createRandomizedPolygon.js.map +1 -0
- package/src/_cjs/utils/creategui.js +434 -0
- package/src/_cjs/utils/dat.gui.arrowbounce.polyfill.js +128 -0
- package/src/_cjs/utils/dat.gui.title.polyfill.js +35 -0
- package/src/_cjs/utils/datastructures/CircularIntervalSet.d.ts +83 -0
- package/src/_cjs/utils/datastructures/CircularIntervalSet.js +163 -0
- package/src/_cjs/utils/datastructures/CircularIntervalSet.js.map +1 -0
- package/src/_cjs/utils/datastructures/Color.d.ts +391 -0
- package/src/_cjs/utils/datastructures/Color.js +1084 -0
- package/src/_cjs/utils/datastructures/Color.js.map +1 -0
- package/src/_cjs/utils/datastructures/ColorGradient.d.ts +81 -0
- package/src/_cjs/utils/datastructures/ColorGradient.js +176 -0
- package/src/_cjs/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/_cjs/utils/datastructures/DataGrid2d.d.ts +53 -0
- package/src/_cjs/utils/datastructures/DataGrid2d.js +20 -0
- package/src/_cjs/utils/datastructures/DataGrid2d.js.map +1 -0
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
- package/src/_cjs/utils/datastructures/GenericPath.d.ts +86 -0
- package/src/_cjs/utils/datastructures/GenericPath.js +122 -0
- package/src/_cjs/utils/datastructures/GenericPath.js.map +1 -0
- package/src/_cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/_cjs/utils/datastructures/GeometryMesh.js +58 -0
- package/src/_cjs/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/_cjs/utils/datastructures/Girih.d.ts +181 -0
- package/src/_cjs/utils/datastructures/Girih.js +266 -0
- package/src/_cjs/utils/datastructures/Girih.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihBowtie.d.ts +37 -0
- package/src/_cjs/utils/datastructures/GirihBowtie.js +152 -0
- package/src/_cjs/utils/datastructures/GirihBowtie.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihDecagon.d.ts +52 -0
- package/src/_cjs/utils/datastructures/GirihDecagon.js +132 -0
- package/src/_cjs/utils/datastructures/GirihDecagon.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihHexagon.d.ts +39 -0
- package/src/_cjs/utils/datastructures/GirihHexagon.js +200 -0
- package/src/_cjs/utils/datastructures/GirihHexagon.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js +189 -0
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihPentagon.d.ts +37 -0
- package/src/_cjs/utils/datastructures/GirihPentagon.js +109 -0
- package/src/_cjs/utils/datastructures/GirihPentagon.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihRhombus.d.ts +38 -0
- package/src/_cjs/utils/datastructures/GirihRhombus.js +155 -0
- package/src/_cjs/utils/datastructures/GirihRhombus.js.map +1 -0
- package/src/_cjs/utils/datastructures/GirihTile.d.ts +283 -0
- package/src/_cjs/utils/datastructures/GirihTile.js +308 -0
- package/src/_cjs/utils/datastructures/GirihTile.js.map +1 -0
- package/src/_cjs/utils/datastructures/Matrix4x4.d.ts +244 -0
- package/src/_cjs/utils/datastructures/Matrix4x4.js +262 -0
- package/src/_cjs/utils/datastructures/Matrix4x4.js.map +1 -0
- package/src/_cjs/utils/datastructures/VoronoiCell.d.ts +122 -0
- package/src/_cjs/utils/datastructures/VoronoiCell.js +183 -0
- package/src/_cjs/utils/datastructures/VoronoiCell.js.map +1 -0
- package/src/_cjs/utils/datastructures/interfaces.d.ts +13 -0
- package/src/_cjs/utils/datastructures/interfaces.js +10 -0
- package/src/_cjs/utils/datastructures/interfaces.js.map +1 -0
- package/src/_cjs/utils/detectDarkMode.d.ts +10 -0
- package/src/_cjs/utils/detectDarkMode.js +41 -0
- package/src/_cjs/utils/detectDarkMode.js.map +1 -0
- package/src/_cjs/utils/dom/components/ColorGradientPicker.d.ts +246 -0
- package/src/_cjs/utils/dom/components/ColorGradientPicker.js +667 -0
- package/src/_cjs/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js +520 -0
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/_cjs/utils/dom/components/ColorGradientSelector.d.ts +118 -0
- package/src/_cjs/utils/dom/components/ColorGradientSelector.js +327 -0
- package/src/_cjs/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/_cjs/utils/dom/components/Test.d.ts +7 -0
- package/src/_cjs/utils/dom/components/Test.js +30 -0
- package/src/_cjs/utils/dom/components/Test.js.map +1 -0
- package/src/_cjs/utils/dom/getAvailableContainerSpace.d.ts +2 -0
- package/src/_cjs/utils/dom/getAvailableContainerSpace.js +29 -0
- package/src/_cjs/utils/dom/getAvailableContainerSpace.js.map +1 -0
- package/src/_cjs/utils/dom/getFProp.d.ts +5 -0
- package/src/_cjs/utils/dom/getFProp.js +12 -0
- package/src/_cjs/utils/dom/getFProp.js.map +1 -0
- package/src/_cjs/utils/dom/guiSizeToggler.d.ts +18 -0
- package/src/_cjs/utils/dom/guiSizeToggler.js +44 -0
- package/src/_cjs/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/_cjs/utils/findInVertexArray.d.ts +19 -0
- package/src/_cjs/utils/findInVertexArray.js +29 -0
- package/src/_cjs/utils/findInVertexArray.js.map +1 -0
- package/src/_cjs/utils/getFProp.d.ts +5 -0
- package/src/_cjs/utils/getFProp.js +12 -0
- package/src/_cjs/utils/getFProp.js.map +1 -0
- package/src/_cjs/utils/gup.d.ts +14 -0
- package/src/_cjs/utils/gup.js +31 -0
- package/src/_cjs/utils/gup.js.map +1 -0
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js +655 -0
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
- package/src/_cjs/utils/helpers/CircleHelper.d.ts +73 -0
- package/src/_cjs/utils/helpers/CircleHelper.js +93 -0
- package/src/_cjs/utils/helpers/CircleHelper.js.map +1 -0
- package/src/_cjs/utils/helpers/CircleSectorHelper.d.ts +90 -0
- package/src/_cjs/utils/helpers/CircleSectorHelper.js +114 -0
- package/src/_cjs/utils/helpers/CircleSectorHelper.js.map +1 -0
- package/src/_cjs/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/_cjs/utils/helpers/TriangleHelper.js +83 -0
- package/src/_cjs/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/_cjs/utils/helpers/VEllipseHelper.d.ts +32 -0
- package/src/_cjs/utils/helpers/VEllipseHelper.js +88 -0
- package/src/_cjs/utils/helpers/VEllipseHelper.js.map +1 -0
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.js +135 -0
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.js.map +1 -0
- package/src/_cjs/utils/io/DndFileHandler.d.ts +63 -0
- package/src/_cjs/utils/io/DndFileHandler.js +112 -0
- package/src/_cjs/utils/io/DndFileHandler.js.map +1 -0
- package/src/_cjs/utils/io/FileDrop.d.ts +110 -0
- package/src/_cjs/utils/io/FileDrop.js +177 -0
- package/src/_cjs/utils/io/FileDrop.js.map +1 -0
- package/src/_cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
- package/src/_cjs/utils/lil.gui.title.polyfill.js +32 -0
- package/src/_cjs/utils/module.js +18 -0
- package/src/_cjs/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/_cjs/utils/parsers/LinearColorGradientParser.js +224 -0
- package/src/_cjs/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/_cjs/utils/parsers/OBJParser.d.ts +24 -0
- package/src/_cjs/utils/parsers/OBJParser.js +77 -0
- package/src/_cjs/utils/parsers/OBJParser.js.map +1 -0
- package/src/_cjs/utils/parsers/STLParser.d.ts +61 -0
- package/src/_cjs/utils/parsers/STLParser.js +182 -0
- package/src/_cjs/utils/parsers/STLParser.js.map +1 -0
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.js +486 -0
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.js.map +1 -0
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.js +53 -0
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.js.map +1 -0
- package/src/_cjs/utils/parsers/svg/types.d.ts +63 -0
- package/src/_cjs/utils/parsers/svg/types.js +17 -0
- package/src/_cjs/utils/parsers/svg/types.js.map +1 -0
- package/src/_cjs/utils/ts-runner.js +146 -0
- package/src/_cjs/utils/tsAsyncScriptLoader.js +74 -0
- package/src/_esm/BezierPath.d.ts +610 -0
- package/src/_esm/BezierPath.js +1124 -0
- package/src/_esm/BezierPath.js.map +1 -0
- package/src/_esm/Bounds.d.ts +252 -0
- package/src/_esm/Bounds.js +317 -0
- package/src/_esm/Bounds.js.map +1 -0
- package/src/_esm/Circle.d.ts +214 -0
- package/src/_esm/Circle.js +335 -0
- package/src/_esm/Circle.js.map +1 -0
- package/src/_esm/CircleSector.d.ts +211 -0
- package/src/_esm/CircleSector.js +359 -0
- package/src/_esm/CircleSector.js.map +1 -0
- package/src/_esm/CubicBezierCurve.d.ts +656 -0
- package/src/_esm/CubicBezierCurve.js +1057 -0
- package/src/_esm/CubicBezierCurve.js.map +1 -0
- package/src/_esm/Grid.d.ts +83 -0
- package/src/_esm/Grid.js +89 -0
- package/src/_esm/Grid.js.map +1 -0
- package/src/_esm/KeyHandler.d.ts +177 -0
- package/src/_esm/KeyHandler.js +434 -0
- package/src/_esm/KeyHandler.js.map +1 -0
- package/src/_esm/Line.d.ts +134 -0
- package/src/_esm/Line.js +200 -0
- package/src/_esm/Line.js.map +1 -0
- package/src/_esm/MouseHandler.d.ts +283 -0
- package/src/_esm/MouseHandler.js +397 -0
- package/src/_esm/MouseHandler.js.map +1 -0
- package/src/_esm/PBImage.d.ts +81 -0
- package/src/_esm/PBImage.js +60 -0
- package/src/_esm/PBImage.js.map +1 -0
- package/src/_esm/PBText.d.ts +118 -0
- package/src/_esm/PBText.js +62 -0
- package/src/_esm/PBText.js.map +1 -0
- package/src/_esm/PlotBoilerplate.d.ts +899 -0
- package/src/_esm/PlotBoilerplate.js +2347 -0
- package/src/_esm/PlotBoilerplate.js.map +1 -0
- package/src/_esm/Polygon.d.ts +520 -0
- package/src/_esm/Polygon.js +924 -0
- package/src/_esm/Polygon.js.map +1 -0
- package/src/_esm/SVGBuilder.d.ts +47 -0
- package/src/_esm/SVGBuilder.js +95 -0
- package/src/_esm/SVGBuilder.js.map +1 -0
- package/src/_esm/Triangle.d.ts +392 -0
- package/src/_esm/Triangle.js +493 -0
- package/src/_esm/Triangle.js.map +1 -0
- package/src/_esm/UIDGenerator.d.ts +12 -0
- package/src/_esm/UIDGenerator.js +18 -0
- package/src/_esm/UIDGenerator.js.map +1 -0
- package/src/_esm/VEllipse.d.ts +319 -0
- package/src/_esm/VEllipse.js +574 -0
- package/src/_esm/VEllipse.js.map +1 -0
- package/src/_esm/VEllipseSector.d.ts +230 -0
- package/src/_esm/VEllipseSector.js +422 -0
- package/src/_esm/VEllipseSector.js.map +1 -0
- package/src/_esm/Vector.d.ts +126 -0
- package/src/_esm/Vector.js +181 -0
- package/src/_esm/Vector.js.map +1 -0
- package/src/_esm/VertTuple.d.ts +284 -0
- package/src/_esm/VertTuple.js +347 -0
- package/src/_esm/VertTuple.js.map +1 -0
- package/src/_esm/Vertex.d.ts +498 -0
- package/src/_esm/Vertex.js +702 -0
- package/src/_esm/Vertex.js.map +1 -0
- package/src/_esm/VertexAttr.d.ts +72 -0
- package/src/_esm/VertexAttr.js +58 -0
- package/src/_esm/VertexAttr.js.map +1 -0
- package/src/_esm/VertexListeners.d.ts +209 -0
- package/src/_esm/VertexListeners.js +270 -0
- package/src/_esm/VertexListeners.js.map +1 -0
- package/src/_esm/draw.d.ts +657 -0
- package/src/_esm/draw.js +1159 -0
- package/src/_esm/draw.js.map +1 -0
- package/src/_esm/drawgl.d.ts +544 -0
- package/src/_esm/drawgl.js +812 -0
- package/src/_esm/drawgl.js.map +1 -0
- package/src/_esm/drawutilssvg.d.ts +954 -0
- package/src/_esm/drawutilssvg.js +1705 -0
- package/src/_esm/drawutilssvg.js.map +1 -0
- package/src/_esm/entry-glsupport.js +28 -0
- package/src/_esm/entry.js +29 -0
- package/src/_esm/geomutils.d.ts +77 -0
- package/src/_esm/geomutils.js +126 -0
- package/src/_esm/geomutils.js.map +1 -0
- package/src/_esm/index.d.ts +102 -0
- package/src/_esm/index.js +128 -0
- package/src/_esm/index.js.map +1 -0
- package/src/_esm/interfaces/DrawLib.d.ts +582 -0
- package/src/_esm/interfaces/DrawLib.js +32 -0
- package/src/_esm/interfaces/DrawLib.js.map +1 -0
- package/src/_esm/interfaces/additionals.d.ts +95 -0
- package/src/_esm/interfaces/additionals.js +3 -0
- package/src/_esm/interfaces/additionals.js.map +1 -0
- package/src/_esm/interfaces/core.d.ts +286 -0
- package/src/_esm/interfaces/core.js +30 -0
- package/src/_esm/interfaces/core.js.map +1 -0
- package/src/_esm/interfaces/externals.d.ts +56 -0
- package/src/_esm/interfaces/externals.js +8 -0
- package/src/_esm/interfaces/externals.js.map +1 -0
- package/src/_esm/interfaces/index.d.ts +4 -0
- package/src/_esm/interfaces/index.js +21 -0
- package/src/_esm/interfaces/index.js.map +1 -0
- package/src/_esm/module.d.ts +26 -0
- package/src/_esm/module.js +60 -0
- package/src/_esm/module.js.map +1 -0
- package/src/_esm/src/ts/BezierPath.d.ts +610 -0
- package/src/_esm/src/ts/BezierPath.js +1120 -0
- package/src/_esm/src/ts/BezierPath.js.map +1 -0
- package/src/_esm/src/ts/Bounds.d.ts +252 -0
- package/src/_esm/src/ts/Bounds.js +313 -0
- package/src/_esm/src/ts/Bounds.js.map +1 -0
- package/src/_esm/src/ts/Circle.d.ts +214 -0
- package/src/_esm/src/ts/Circle.js +331 -0
- package/src/_esm/src/ts/Circle.js.map +1 -0
- package/src/_esm/src/ts/CircleSector.d.ts +211 -0
- package/src/_esm/src/ts/CircleSector.js +355 -0
- package/src/_esm/src/ts/CircleSector.js.map +1 -0
- package/src/_esm/src/ts/CubicBezierCurve.d.ts +656 -0
- package/src/_esm/src/ts/CubicBezierCurve.js +1053 -0
- package/src/_esm/src/ts/CubicBezierCurve.js.map +1 -0
- package/src/_esm/src/ts/Grid.d.ts +83 -0
- package/src/_esm/src/ts/Grid.js +85 -0
- package/src/_esm/src/ts/Grid.js.map +1 -0
- package/src/_esm/src/ts/KeyHandler.d.ts +177 -0
- package/src/_esm/src/ts/KeyHandler.js +430 -0
- package/src/_esm/src/ts/KeyHandler.js.map +1 -0
- package/src/_esm/src/ts/Line.d.ts +134 -0
- package/src/_esm/src/ts/Line.js +196 -0
- package/src/_esm/src/ts/Line.js.map +1 -0
- package/src/_esm/src/ts/MouseHandler.d.ts +283 -0
- package/src/_esm/src/ts/MouseHandler.js +391 -0
- package/src/_esm/src/ts/MouseHandler.js.map +1 -0
- package/src/_esm/src/ts/PBImage.d.ts +81 -0
- package/src/_esm/src/ts/PBImage.js +56 -0
- package/src/_esm/src/ts/PBImage.js.map +1 -0
- package/src/_esm/src/ts/PBText.d.ts +118 -0
- package/src/_esm/src/ts/PBText.js +58 -0
- package/src/_esm/src/ts/PBText.js.map +1 -0
- package/src/_esm/src/ts/PlotBoilerplate.d.ts +899 -0
- package/src/_esm/src/ts/PlotBoilerplate.js +2340 -0
- package/src/_esm/src/ts/PlotBoilerplate.js.map +1 -0
- package/src/_esm/src/ts/Polygon.d.ts +520 -0
- package/src/_esm/src/ts/Polygon.js +920 -0
- package/src/_esm/src/ts/Polygon.js.map +1 -0
- package/src/_esm/src/ts/Triangle.d.ts +392 -0
- package/src/_esm/src/ts/Triangle.js +489 -0
- package/src/_esm/src/ts/Triangle.js.map +1 -0
- package/src/_esm/src/ts/UIDGenerator.d.ts +12 -0
- package/src/_esm/src/ts/UIDGenerator.js +14 -0
- package/src/_esm/src/ts/UIDGenerator.js.map +1 -0
- package/src/_esm/src/ts/VEllipse.d.ts +319 -0
- package/src/_esm/src/ts/VEllipse.js +570 -0
- package/src/_esm/src/ts/VEllipse.js.map +1 -0
- package/src/_esm/src/ts/VEllipseSector.d.ts +230 -0
- package/src/_esm/src/ts/VEllipseSector.js +418 -0
- package/src/_esm/src/ts/VEllipseSector.js.map +1 -0
- package/src/_esm/src/ts/Vector.d.ts +126 -0
- package/src/_esm/src/ts/Vector.js +177 -0
- package/src/_esm/src/ts/Vector.js.map +1 -0
- package/src/_esm/src/ts/VertTuple.d.ts +284 -0
- package/src/_esm/src/ts/VertTuple.js +343 -0
- package/src/_esm/src/ts/VertTuple.js.map +1 -0
- package/src/_esm/src/ts/Vertex.d.ts +498 -0
- package/src/_esm/src/ts/Vertex.js +698 -0
- package/src/_esm/src/ts/Vertex.js.map +1 -0
- package/src/_esm/src/ts/VertexAttr.d.ts +72 -0
- package/src/_esm/src/ts/VertexAttr.js +54 -0
- package/src/_esm/src/ts/VertexAttr.js.map +1 -0
- package/src/_esm/src/ts/VertexListeners.d.ts +209 -0
- package/src/_esm/src/ts/VertexListeners.js +266 -0
- package/src/_esm/src/ts/VertexListeners.js.map +1 -0
- package/src/_esm/src/ts/draw.d.ts +657 -0
- package/src/_esm/src/ts/draw.js +1155 -0
- package/src/_esm/src/ts/draw.js.map +1 -0
- package/src/_esm/src/ts/drawgl.d.ts +544 -0
- package/src/_esm/src/ts/drawgl.js +808 -0
- package/src/_esm/src/ts/drawgl.js.map +1 -0
- package/src/_esm/src/ts/drawutilssvg.d.ts +954 -0
- package/src/_esm/src/ts/drawutilssvg.js +1701 -0
- package/src/_esm/src/ts/drawutilssvg.js.map +1 -0
- package/src/_esm/src/ts/geomutils.d.ts +77 -0
- package/src/_esm/src/ts/geomutils.js +123 -0
- package/src/_esm/src/ts/geomutils.js.map +1 -0
- package/src/_esm/src/ts/index.d.ts +102 -0
- package/src/_esm/src/ts/index.js +112 -0
- package/src/_esm/src/ts/index.js.map +1 -0
- package/src/_esm/src/ts/interfaces/DrawLib.d.ts +582 -0
- package/src/_esm/src/ts/interfaces/DrawLib.js +31 -0
- package/src/_esm/src/ts/interfaces/DrawLib.js.map +1 -0
- package/src/_esm/src/ts/interfaces/additionals.d.ts +95 -0
- package/src/_esm/src/ts/interfaces/additionals.js +2 -0
- package/src/_esm/src/ts/interfaces/additionals.js.map +1 -0
- package/src/_esm/src/ts/interfaces/core.d.ts +286 -0
- package/src/_esm/src/ts/interfaces/core.js +29 -0
- package/src/_esm/src/ts/interfaces/core.js.map +1 -0
- package/src/_esm/src/ts/interfaces/externals.d.ts +56 -0
- package/src/_esm/src/ts/interfaces/externals.js +7 -0
- package/src/_esm/src/ts/interfaces/externals.js.map +1 -0
- package/src/_esm/src/ts/interfaces/index.d.ts +4 -0
- package/src/_esm/src/ts/interfaces/index.js +5 -0
- package/src/_esm/src/ts/interfaces/index.js.map +1 -0
- package/src/_esm/src/ts/module.d.ts +26 -0
- package/src/_esm/src/ts/module.js +38 -0
- package/src/_esm/src/ts/module.js.map +1 -0
- package/src/_esm/src/ts/utils/InitializationObserver.d.ts +18 -0
- package/src/_esm/src/ts/utils/InitializationObserver.js +57 -0
- package/src/_esm/src/ts/utils/InitializationObserver.js.map +1 -0
- package/src/_esm/src/ts/utils/LissajousFigure.d.ts +34 -0
- package/src/_esm/src/ts/utils/LissajousFigure.js +95 -0
- package/src/_esm/src/ts/utils/LissajousFigure.js.map +1 -0
- package/src/_esm/src/ts/utils/NGons.d.ts +13 -0
- package/src/_esm/src/ts/utils/NGons.js +33 -0
- package/src/_esm/src/ts/utils/NGons.js.map +1 -0
- package/src/_esm/src/ts/utils/Params.d.ts +17 -0
- package/src/_esm/src/ts/utils/Params.js +48 -0
- package/src/_esm/src/ts/utils/Params.js.map +1 -0
- package/src/_esm/src/ts/utils/PerlinNoise.d.ts +19 -0
- package/src/_esm/src/ts/utils/PerlinNoise.js +346 -0
- package/src/_esm/src/ts/utils/PerlinNoise.js.map +1 -0
- package/src/_esm/src/ts/utils/SVGPathUtils.d.ts +22 -0
- package/src/_esm/src/ts/utils/SVGPathUtils.js +42 -0
- package/src/_esm/src/ts/utils/SVGPathUtils.js.map +1 -0
- package/src/_esm/src/ts/utils/WebColors.d.ts +35 -0
- package/src/_esm/src/ts/utils/WebColors.js +54 -0
- package/src/_esm/src/ts/utils/WebColors.js.map +1 -0
- package/src/_esm/src/ts/utils/WebColorsContrast.d.ts +6 -0
- package/src/_esm/src/ts/utils/WebColorsContrast.js +9 -0
- package/src/_esm/src/ts/utils/WebColorsContrast.js.map +1 -0
- package/src/_esm/src/ts/utils/WebColorsMalachite.d.ts +12 -0
- package/src/_esm/src/ts/utils/WebColorsMalachite.js +25 -0
- package/src/_esm/src/ts/utils/WebColorsMalachite.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.d.ts +60 -0
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js +103 -0
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.d.ts +170 -0
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js +303 -0
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.d.ts +150 -0
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js +362 -0
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.d.ts +63 -0
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js +170 -0
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.d.ts +81 -0
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.js +273 -0
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/Metaballs.d.ts +30 -0
- package/src/_esm/src/ts/utils/algorithms/Metaballs.js +109 -0
- package/src/_esm/src/ts/utils/algorithms/Metaballs.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.d.ts +184 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.js +424 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js +262 -0
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/arrayFill.d.ts +8 -0
- package/src/_esm/src/ts/utils/algorithms/arrayFill.js +14 -0
- package/src/_esm/src/ts/utils/algorithms/arrayFill.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/arrayResize.d.ts +8 -0
- package/src/_esm/src/ts/utils/algorithms/arrayResize.js +20 -0
- package/src/_esm/src/ts/utils/algorithms/arrayResize.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js +11 -0
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js +47 -0
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js +57 -0
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/convexHull.d.ts +23 -0
- package/src/_esm/src/ts/utils/algorithms/convexHull.js +67 -0
- package/src/_esm/src/ts/utils/algorithms/convexHull.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js +141 -0
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay.d.ts +30 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay.js +153 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.d.ts +25 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js +99 -0
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/detectPaths.d.ts +21 -0
- package/src/_esm/src/ts/utils/algorithms/detectPaths.js +165 -0
- package/src/_esm/src/ts/utils/algorithms/detectPaths.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js +47 -0
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.d.ts +13 -0
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.js +22 -0
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/matrixFill.d.ts +10 -0
- package/src/_esm/src/ts/utils/algorithms/matrixFill.js +17 -0
- package/src/_esm/src/ts/utils/algorithms/matrixFill.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js +99 -0
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.d.ts +16 -0
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js +72 -0
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js.map +1 -0
- package/src/_esm/src/ts/utils/cloneVertexArray.d.ts +13 -0
- package/src/_esm/src/ts/utils/cloneVertexArray.js +19 -0
- package/src/_esm/src/ts/utils/cloneVertexArray.js.map +1 -0
- package/src/_esm/src/ts/utils/createRandomizedPolygon.d.ts +14 -0
- package/src/_esm/src/ts/utils/createRandomizedPolygon.js +28 -0
- package/src/_esm/src/ts/utils/createRandomizedPolygon.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.d.ts +83 -0
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js +158 -0
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/Color.d.ts +391 -0
- package/src/_esm/src/ts/utils/datastructures/Color.js +1063 -0
- package/src/_esm/src/ts/utils/datastructures/Color.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.d.ts +81 -0
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.js +171 -0
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.d.ts +53 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js +19 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js +79 -0
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GenericPath.d.ts +86 -0
- package/src/_esm/src/ts/utils/datastructures/GenericPath.js +117 -0
- package/src/_esm/src/ts/utils/datastructures/GenericPath.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js +53 -0
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/Girih.d.ts +181 -0
- package/src/_esm/src/ts/utils/datastructures/Girih.js +261 -0
- package/src/_esm/src/ts/utils/datastructures/Girih.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.d.ts +37 -0
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js +130 -0
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.d.ts +52 -0
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js +110 -0
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.d.ts +39 -0
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js +178 -0
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js +167 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.d.ts +37 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js +87 -0
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.d.ts +38 -0
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js +133 -0
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/GirihTile.d.ts +283 -0
- package/src/_esm/src/ts/utils/datastructures/GirihTile.js +286 -0
- package/src/_esm/src/ts/utils/datastructures/GirihTile.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.d.ts +244 -0
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js +246 -0
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.d.ts +122 -0
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js +178 -0
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js.map +1 -0
- package/src/_esm/src/ts/utils/datastructures/interfaces.d.ts +13 -0
- package/src/_esm/src/ts/utils/datastructures/interfaces.js +9 -0
- package/src/_esm/src/ts/utils/datastructures/interfaces.js.map +1 -0
- package/src/_esm/src/ts/utils/detectDarkMode.d.ts +10 -0
- package/src/_esm/src/ts/utils/detectDarkMode.js +37 -0
- package/src/_esm/src/ts/utils/detectDarkMode.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.d.ts +246 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js +743 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.d.ts +118 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js +339 -0
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/components/Test.d.ts +7 -0
- package/src/_esm/src/ts/utils/dom/components/Test.js +26 -0
- package/src/_esm/src/ts/utils/dom/components/Test.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.d.ts +2 -0
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js +25 -0
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/getFProp.d.ts +5 -0
- package/src/_esm/src/ts/utils/dom/getFProp.js +8 -0
- package/src/_esm/src/ts/utils/dom/getFProp.js.map +1 -0
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.d.ts +18 -0
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.js +40 -0
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/_esm/src/ts/utils/findInVertexArray.d.ts +19 -0
- package/src/_esm/src/ts/utils/findInVertexArray.js +25 -0
- package/src/_esm/src/ts/utils/findInVertexArray.js.map +1 -0
- package/src/_esm/src/ts/utils/gup.d.ts +14 -0
- package/src/_esm/src/ts/utils/gup.js +27 -0
- package/src/_esm/src/ts/utils/gup.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js +648 -0
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/CircleHelper.d.ts +73 -0
- package/src/_esm/src/ts/utils/helpers/CircleHelper.js +88 -0
- package/src/_esm/src/ts/utils/helpers/CircleHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.d.ts +90 -0
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js +109 -0
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.js +78 -0
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.d.ts +32 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js +83 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js +130 -0
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js.map +1 -0
- package/src/_esm/src/ts/utils/io/FileDrop.d.ts +110 -0
- package/src/_esm/src/ts/utils/io/FileDrop.js +171 -0
- package/src/_esm/src/ts/utils/io/FileDrop.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js +217 -0
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/OBJParser.d.ts +24 -0
- package/src/_esm/src/ts/utils/parsers/OBJParser.js +72 -0
- package/src/_esm/src/ts/utils/parsers/OBJParser.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/STLParser.d.ts +61 -0
- package/src/_esm/src/ts/utils/parsers/STLParser.js +175 -0
- package/src/_esm/src/ts/utils/parsers/STLParser.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js +482 -0
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js +49 -0
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js.map +1 -0
- package/src/_esm/src/ts/utils/parsers/svg/types.d.ts +63 -0
- package/src/_esm/src/ts/utils/parsers/svg/types.js +16 -0
- package/src/_esm/src/ts/utils/parsers/svg/types.js.map +1 -0
- package/src/_esm/utils/InitializationObserver.d.ts +18 -0
- package/src/_esm/utils/InitializationObserver.js +61 -0
- package/src/_esm/utils/InitializationObserver.js.map +1 -0
- package/src/_esm/utils/LissajousFigure.d.ts +34 -0
- package/src/_esm/utils/LissajousFigure.js +99 -0
- package/src/_esm/utils/LissajousFigure.js.map +1 -0
- package/src/_esm/utils/NGons.d.ts +13 -0
- package/src/_esm/utils/NGons.js +36 -0
- package/src/_esm/utils/NGons.js.map +1 -0
- package/src/_esm/utils/Params.d.ts +17 -0
- package/src/_esm/utils/Params.js +52 -0
- package/src/_esm/utils/Params.js.map +1 -0
- package/src/_esm/utils/PerlinNoise.d.ts +19 -0
- package/src/_esm/utils/PerlinNoise.js +350 -0
- package/src/_esm/utils/PerlinNoise.js.map +1 -0
- package/src/_esm/utils/SVGPathUtils.d.ts +22 -0
- package/src/_esm/utils/SVGPathUtils.js +45 -0
- package/src/_esm/utils/SVGPathUtils.js.map +1 -0
- package/src/_esm/utils/WebColors.d.ts +35 -0
- package/src/_esm/utils/WebColors.js +58 -0
- package/src/_esm/utils/WebColors.js.map +1 -0
- package/src/_esm/utils/WebColorsContrast.d.ts +6 -0
- package/src/_esm/utils/WebColorsContrast.js +12 -0
- package/src/_esm/utils/WebColorsContrast.js.map +1 -0
- package/src/_esm/utils/WebColorsMalachite.d.ts +12 -0
- package/src/_esm/utils/WebColorsMalachite.js +28 -0
- package/src/_esm/utils/WebColorsMalachite.js.map +1 -0
- package/src/_esm/utils/algorithms/CatmullRomPath.d.ts +60 -0
- package/src/_esm/utils/algorithms/CatmullRomPath.js +107 -0
- package/src/_esm/utils/algorithms/CatmullRomPath.js.map +1 -0
- package/src/_esm/utils/algorithms/CircleIntersections.d.ts +170 -0
- package/src/_esm/utils/algorithms/CircleIntersections.js +307 -0
- package/src/_esm/utils/algorithms/CircleIntersections.js.map +1 -0
- package/src/_esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
- package/src/_esm/utils/algorithms/ContourLineDetection.js +366 -0
- package/src/_esm/utils/algorithms/ContourLineDetection.js.map +1 -0
- package/src/_esm/utils/algorithms/CubicSplinePath.d.ts +63 -0
- package/src/_esm/utils/algorithms/CubicSplinePath.js +174 -0
- package/src/_esm/utils/algorithms/CubicSplinePath.js.map +1 -0
- package/src/_esm/utils/algorithms/HobbyPath.d.ts +81 -0
- package/src/_esm/utils/algorithms/HobbyPath.js +277 -0
- package/src/_esm/utils/algorithms/HobbyPath.js.map +1 -0
- package/src/_esm/utils/algorithms/Metaballs.d.ts +30 -0
- package/src/_esm/utils/algorithms/Metaballs.js +113 -0
- package/src/_esm/utils/algorithms/Metaballs.js.map +1 -0
- package/src/_esm/utils/algorithms/PolygonInset.d.ts +184 -0
- package/src/_esm/utils/algorithms/PolygonInset.js +428 -0
- package/src/_esm/utils/algorithms/PolygonInset.js.map +1 -0
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js +267 -0
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/_esm/utils/algorithms/arrayFill.d.ts +8 -0
- package/src/_esm/utils/algorithms/arrayFill.js +18 -0
- package/src/_esm/utils/algorithms/arrayFill.js.map +1 -0
- package/src/_esm/utils/algorithms/arrayResize.d.ts +8 -0
- package/src/_esm/utils/algorithms/arrayResize.js +24 -0
- package/src/_esm/utils/algorithms/arrayResize.js.map +1 -0
- package/src/_esm/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/_esm/utils/algorithms/arrayShuffle.js +15 -0
- package/src/_esm/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/_esm/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
- package/src/_esm/utils/algorithms/clearDuplicateVertices.js +51 -0
- package/src/_esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js +61 -0
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
- package/src/_esm/utils/algorithms/convexHull.d.ts +23 -0
- package/src/_esm/utils/algorithms/convexHull.js +71 -0
- package/src/_esm/utils/algorithms/convexHull.js.map +1 -0
- package/src/_esm/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
- package/src/_esm/utils/algorithms/convexPolygonIncircle.js +145 -0
- package/src/_esm/utils/algorithms/convexPolygonIncircle.js.map +1 -0
- package/src/_esm/utils/algorithms/createRandomizedPolygon.d.ts +14 -0
- package/src/_esm/utils/algorithms/createRandomizedPolygon.js +28 -0
- package/src/_esm/utils/algorithms/createRandomizedPolygon.js.map +1 -0
- package/src/_esm/utils/algorithms/delaunay.d.ts +30 -0
- package/src/_esm/utils/algorithms/delaunay.js +157 -0
- package/src/_esm/utils/algorithms/delaunay.js.map +1 -0
- package/src/_esm/utils/algorithms/delaunay2voronoi.d.ts +25 -0
- package/src/_esm/utils/algorithms/delaunay2voronoi.js +103 -0
- package/src/_esm/utils/algorithms/delaunay2voronoi.js.map +1 -0
- package/src/_esm/utils/algorithms/detectPaths.d.ts +21 -0
- package/src/_esm/utils/algorithms/detectPaths.js +169 -0
- package/src/_esm/utils/algorithms/detectPaths.js.map +1 -0
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js +51 -0
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
- package/src/_esm/utils/algorithms/getContrastColor.d.ts +13 -0
- package/src/_esm/utils/algorithms/getContrastColor.js +26 -0
- package/src/_esm/utils/algorithms/getContrastColor.js.map +1 -0
- package/src/_esm/utils/algorithms/matrixFill.d.ts +10 -0
- package/src/_esm/utils/algorithms/matrixFill.js +21 -0
- package/src/_esm/utils/algorithms/matrixFill.js.map +1 -0
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js +102 -0
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
- package/src/_esm/utils/algorithms/sutherlandHodgman.d.ts +16 -0
- package/src/_esm/utils/algorithms/sutherlandHodgman.js +76 -0
- package/src/_esm/utils/algorithms/sutherlandHodgman.js.map +1 -0
- package/src/_esm/utils/cloneVertexArray.d.ts +13 -0
- package/src/_esm/utils/cloneVertexArray.js +23 -0
- package/src/_esm/utils/cloneVertexArray.js.map +1 -0
- package/src/_esm/utils/createRandomizedPolygon.d.ts +14 -0
- package/src/_esm/utils/createRandomizedPolygon.js +32 -0
- package/src/_esm/utils/createRandomizedPolygon.js.map +1 -0
- package/src/_esm/utils/datastructures/CircularIntervalSet.d.ts +83 -0
- package/src/_esm/utils/datastructures/CircularIntervalSet.js +162 -0
- package/src/_esm/utils/datastructures/CircularIntervalSet.js.map +1 -0
- package/src/_esm/utils/datastructures/Color.d.ts +391 -0
- package/src/_esm/utils/datastructures/Color.js +1067 -0
- package/src/_esm/utils/datastructures/Color.js.map +1 -0
- package/src/_esm/utils/datastructures/ColorGradient.d.ts +81 -0
- package/src/_esm/utils/datastructures/ColorGradient.js +175 -0
- package/src/_esm/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/_esm/utils/datastructures/DataGrid2d.d.ts +53 -0
- package/src/_esm/utils/datastructures/DataGrid2d.js +20 -0
- package/src/_esm/utils/datastructures/DataGrid2d.js.map +1 -0
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js +154 -0
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js +83 -0
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
- package/src/_esm/utils/datastructures/GenericPath.d.ts +86 -0
- package/src/_esm/utils/datastructures/GenericPath.js +121 -0
- package/src/_esm/utils/datastructures/GenericPath.js.map +1 -0
- package/src/_esm/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/_esm/utils/datastructures/GeometryMesh.js +57 -0
- package/src/_esm/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/_esm/utils/datastructures/Girih.d.ts +181 -0
- package/src/_esm/utils/datastructures/Girih.js +265 -0
- package/src/_esm/utils/datastructures/Girih.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihBowtie.d.ts +37 -0
- package/src/_esm/utils/datastructures/GirihBowtie.js +134 -0
- package/src/_esm/utils/datastructures/GirihBowtie.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihDecagon.d.ts +52 -0
- package/src/_esm/utils/datastructures/GirihDecagon.js +114 -0
- package/src/_esm/utils/datastructures/GirihDecagon.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihHexagon.d.ts +39 -0
- package/src/_esm/utils/datastructures/GirihHexagon.js +182 -0
- package/src/_esm/utils/datastructures/GirihHexagon.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.js +171 -0
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihPentagon.d.ts +37 -0
- package/src/_esm/utils/datastructures/GirihPentagon.js +91 -0
- package/src/_esm/utils/datastructures/GirihPentagon.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihRhombus.d.ts +38 -0
- package/src/_esm/utils/datastructures/GirihRhombus.js +137 -0
- package/src/_esm/utils/datastructures/GirihRhombus.js.map +1 -0
- package/src/_esm/utils/datastructures/GirihTile.d.ts +283 -0
- package/src/_esm/utils/datastructures/GirihTile.js +290 -0
- package/src/_esm/utils/datastructures/GirihTile.js.map +1 -0
- package/src/_esm/utils/datastructures/Matrix4x4.d.ts +244 -0
- package/src/_esm/utils/datastructures/Matrix4x4.js +250 -0
- package/src/_esm/utils/datastructures/Matrix4x4.js.map +1 -0
- package/src/_esm/utils/datastructures/VoronoiCell.d.ts +122 -0
- package/src/_esm/utils/datastructures/VoronoiCell.js +182 -0
- package/src/_esm/utils/datastructures/VoronoiCell.js.map +1 -0
- package/src/_esm/utils/datastructures/interfaces.d.ts +13 -0
- package/src/_esm/utils/datastructures/interfaces.js +10 -0
- package/src/_esm/utils/datastructures/interfaces.js.map +1 -0
- package/src/_esm/utils/detectDarkMode.d.ts +10 -0
- package/src/_esm/utils/detectDarkMode.js +41 -0
- package/src/_esm/utils/detectDarkMode.js.map +1 -0
- package/src/_esm/utils/dom/components/ColorGradientPicker.d.ts +246 -0
- package/src/_esm/utils/dom/components/ColorGradientPicker.js +780 -0
- package/src/_esm/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js +582 -0
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/_esm/utils/dom/components/ColorGradientSelector.d.ts +118 -0
- package/src/_esm/utils/dom/components/ColorGradientSelector.js +376 -0
- package/src/_esm/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/_esm/utils/dom/components/Test.d.ts +7 -0
- package/src/_esm/utils/dom/components/Test.js +63 -0
- package/src/_esm/utils/dom/components/Test.js.map +1 -0
- package/src/_esm/utils/dom/getAvailableContainerSpace.d.ts +2 -0
- package/src/_esm/utils/dom/getAvailableContainerSpace.js +29 -0
- package/src/_esm/utils/dom/getAvailableContainerSpace.js.map +1 -0
- package/src/_esm/utils/dom/getFProp.d.ts +5 -0
- package/src/_esm/utils/dom/getFProp.js +12 -0
- package/src/_esm/utils/dom/getFProp.js.map +1 -0
- package/src/_esm/utils/dom/guiSizeToggler.d.ts +18 -0
- package/src/_esm/utils/dom/guiSizeToggler.js +44 -0
- package/src/_esm/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/_esm/utils/findInVertexArray.d.ts +19 -0
- package/src/_esm/utils/findInVertexArray.js +29 -0
- package/src/_esm/utils/findInVertexArray.js.map +1 -0
- package/src/_esm/utils/getFProp.d.ts +5 -0
- package/src/_esm/utils/getFProp.js +8 -0
- package/src/_esm/utils/getFProp.js.map +1 -0
- package/src/_esm/utils/gup.d.ts +14 -0
- package/src/_esm/utils/gup.js +31 -0
- package/src/_esm/utils/gup.js.map +1 -0
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.js +655 -0
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
- package/src/_esm/utils/helpers/CircleHelper.d.ts +73 -0
- package/src/_esm/utils/helpers/CircleHelper.js +92 -0
- package/src/_esm/utils/helpers/CircleHelper.js.map +1 -0
- package/src/_esm/utils/helpers/CircleSectorHelper.d.ts +90 -0
- package/src/_esm/utils/helpers/CircleSectorHelper.js +113 -0
- package/src/_esm/utils/helpers/CircleSectorHelper.js.map +1 -0
- package/src/_esm/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/_esm/utils/helpers/TriangleHelper.js +82 -0
- package/src/_esm/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/_esm/utils/helpers/VEllipseHelper.d.ts +32 -0
- package/src/_esm/utils/helpers/VEllipseHelper.js +87 -0
- package/src/_esm/utils/helpers/VEllipseHelper.js.map +1 -0
- package/src/_esm/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
- package/src/_esm/utils/helpers/VEllipseSectorHelper.js +134 -0
- package/src/_esm/utils/helpers/VEllipseSectorHelper.js.map +1 -0
- package/src/_esm/utils/io/DndFileHandler.d.ts +63 -0
- package/src/_esm/utils/io/DndFileHandler.js +106 -0
- package/src/_esm/utils/io/DndFileHandler.js.map +1 -0
- package/src/_esm/utils/io/FileDrop.d.ts +110 -0
- package/src/_esm/utils/io/FileDrop.js +175 -0
- package/src/_esm/utils/io/FileDrop.js.map +1 -0
- package/src/_esm/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/_esm/utils/parsers/LinearColorGradientParser.js +223 -0
- package/src/_esm/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/_esm/utils/parsers/OBJParser.d.ts +25 -0
- package/src/_esm/utils/parsers/OBJParser.js +78 -0
- package/src/_esm/utils/parsers/OBJParser.js.map +1 -0
- package/src/_esm/utils/parsers/STLParser.d.ts +61 -0
- package/src/_esm/utils/parsers/STLParser.js +179 -0
- package/src/_esm/utils/parsers/STLParser.js.map +1 -0
- package/src/_esm/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
- package/src/_esm/utils/parsers/svg/parseSVGPathData.js +486 -0
- package/src/_esm/utils/parsers/svg/parseSVGPathData.js.map +1 -0
- package/src/_esm/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
- package/src/_esm/utils/parsers/svg/splitSVGPathData.js +53 -0
- package/src/_esm/utils/parsers/svg/splitSVGPathData.js.map +1 -0
- package/src/_esm/utils/parsers/svg/types.d.ts +63 -0
- package/src/_esm/utils/parsers/svg/types.js +17 -0
- package/src/_esm/utils/parsers/svg/types.js.map +1 -0
- package/src/cjs/PlotBoilerplate.d.ts +11 -1
- package/src/cjs/PlotBoilerplate.js +23 -7
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/VertexListeners.d.ts +2 -1
- package/src/cjs/VertexListeners.js +5 -1
- package/src/cjs/VertexListeners.js.map +1 -1
- package/src/cjs/draw.d.ts +18 -2
- package/src/cjs/draw.js +21 -2
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +18 -3
- package/src/cjs/drawgl.js +19 -2
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +19 -1
- package/src/cjs/drawutilssvg.js +28 -5
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +18 -1
- package/src/cjs/interfaces/DrawLib.js +2 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/utils/Params.d.ts +3 -2
- package/src/cjs/utils/Params.js +11 -3
- package/src/cjs/utils/Params.js.map +1 -1
- package/src/cjs/utils/WebColors.d.ts +2 -1
- package/src/cjs/utils/WebColors.js +15 -2
- package/src/cjs/utils/WebColors.js.map +1 -1
- package/src/cjs/utils/algorithms/HobbyPath.js +13 -16
- package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
- package/src/cjs/utils/helpers/BezierResizeHelper.d.ts +144 -0
- package/src/cjs/utils/helpers/BezierResizeHelper.js +319 -0
- package/src/cjs/utils/helpers/BezierResizeHelper.js.map +1 -0
- package/src/esm/PlotBoilerplate.d.ts +11 -1
- package/src/esm/PlotBoilerplate.js +23 -7
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/VertexListeners.d.ts +2 -1
- package/src/esm/VertexListeners.js +5 -1
- package/src/esm/VertexListeners.js.map +1 -1
- package/src/esm/draw.d.ts +18 -2
- package/src/esm/draw.js +21 -2
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +18 -3
- package/src/esm/drawgl.js +19 -2
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +19 -1
- package/src/esm/drawutilssvg.js +28 -5
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +18 -1
- package/src/esm/interfaces/DrawLib.js +2 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/utils/Params.d.ts +3 -2
- package/src/esm/utils/Params.js +11 -3
- package/src/esm/utils/Params.js.map +1 -1
- package/src/esm/utils/WebColors.d.ts +2 -1
- package/src/esm/utils/WebColors.js +15 -2
- package/src/esm/utils/WebColors.js.map +1 -1
- package/src/esm/utils/algorithms/HobbyPath.js +13 -16
- package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
- package/src/esm/utils/helpers/BezierResizeHelper.d.ts +144 -0
- package/src/esm/utils/helpers/BezierResizeHelper.js +314 -0
- package/src/esm/utils/helpers/BezierResizeHelper.js.map +1 -0
- package/src/ts/PlotBoilerplate.ts +37 -11
- package/src/ts/VertexListeners.ts +5 -1
- package/src/ts/draw.ts +32 -2
- package/src/ts/drawgl.ts +38 -3
- package/src/ts/drawutilssvg.ts +33 -6
- package/src/ts/interfaces/DrawLib.ts +19 -1
- package/src/ts/utils/Params.ts +11 -3
- package/src/ts/utils/WebColors.ts +15 -2
- package/src/ts/utils/algorithms/HobbyPath.ts +248 -272
- package/src/ts/utils/helpers/BezierResizeHelper.ts +390 -0
- /package/src/{cjs → _cjs}/utils/_gup.js_ +0 -0
package/src/_cjs/draw.js
ADDED
|
@@ -0,0 +1,1164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author Ikaros Kappler
|
|
4
|
+
* @date 2018-04-22
|
|
5
|
+
* @modified 2018-08-16 Added the curve() function to draw cubic bézier curves.
|
|
6
|
+
* @modified 2018-10-23 Recognizing the offset param in the circle() function.
|
|
7
|
+
* @modified 2018-11-27 Added the diamondHandle() function.
|
|
8
|
+
* @modified 2018-11-28 Added the grid() function and the ellipse() function.
|
|
9
|
+
* @modified 2018-11-30 Renamed the text() function to label() as it is not scaling.
|
|
10
|
+
* @modified 2018-12-06 Added a test function for drawing arc in SVG style.
|
|
11
|
+
* @modified 2018-12-09 Added the dot(Vertex,color) function (copied from Feigenbaum-plot-script).
|
|
12
|
+
* @modified 2019-01-30 Added the arrow(Vertex,Vertex,color) function for drawing arrow heads.
|
|
13
|
+
* @modified 2019-01-30 Added the image(Image,Vertex,Vertex) function for drawing images.
|
|
14
|
+
* @modified 2019-04-27 Fixed a severe drawing bug in the arrow(...) function. Scaling arrows did not work properly.
|
|
15
|
+
* @modified 2019-04-28 Added Math.round to the dot() drawing parameters to really draw a singlt dot.
|
|
16
|
+
* @modified 2019-06-07 Fixed an issue in the cubicBezier() function. Paths were always closed.
|
|
17
|
+
* @modified 2019-10-03 Added the beginDrawCycle hook.
|
|
18
|
+
* @modified 2019-10-25 Polygons are no longer drawn with dashed lines (solid lines instead).
|
|
19
|
+
* @modified 2019-11-18 Added the polyline function.
|
|
20
|
+
* @modified 2019-11-22 Added a second workaround for th drawImage bug in Safari.
|
|
21
|
+
* @modified 2019-12-07 Added the 'lineWidth' param to the line(...) function.
|
|
22
|
+
* @modified 2019-12-07 Added the 'lineWidth' param to the cubicBezier(...) function.
|
|
23
|
+
* @modified 2019-12-11 Added the 'color' param to the label(...) function.
|
|
24
|
+
* @modified 2019-12-18 Added the quadraticBezier(...) function (for the sake of approximating Lissajous curves).
|
|
25
|
+
* @modified 2019-12-20 Added the 'lineWidth' param to the polyline(...) function.
|
|
26
|
+
* @modified 2020-01-09 Added the 'lineWidth' param to the ellipse(...) function.
|
|
27
|
+
* @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.
|
|
28
|
+
* @modified 2020-05-05 Added the 'lineWidth' param to the circle(...) function.
|
|
29
|
+
* @modified 2020-05-12 Drawing any handles (square, circle, diamond) with lineWidth 1 now; this was not reset before.
|
|
30
|
+
* @modified 2020-06-22 Added a context.clearRect() call to the clear() function; clearing with alpha channel did not work as expected.
|
|
31
|
+
* @modified 2020-09-07 Added the circleArc(...) function to draw sections of circles.
|
|
32
|
+
* @modified 2020-10-06 Removed the .closePath() instruction from the circleArc function.
|
|
33
|
+
* @modified 2020-10-15 Re-added the text() function.
|
|
34
|
+
* @modified 2020-10-28 Added the path(Path2D) function.
|
|
35
|
+
* @modified 2020-12-28 Added the `singleSegment` mode (test).
|
|
36
|
+
* @modified 2021-01-05 Added the image-loaded/broken check.
|
|
37
|
+
* @modified 2021-01-24 Added the `setCurrentId` function from the `DrawLib` interface.
|
|
38
|
+
* @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.
|
|
39
|
+
* @modified 2021-03-31 Added the `endDrawCycle` function from `DrawLib`.
|
|
40
|
+
* @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.
|
|
41
|
+
* @modified 2021-11-12 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.
|
|
42
|
+
* @modified 2021-11-19 Added the `color` param to the `label(...)` function.
|
|
43
|
+
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
44
|
+
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
45
|
+
* @modified 2022-03-27 Added the `texturedPoly` function.
|
|
46
|
+
* @modified 2022-06-01 Tweaked the `polyline` function; lineWidth now scales with scale.x.
|
|
47
|
+
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
48
|
+
* @modified 2022-08-23 Fixed a type issue in the `polyline` function.
|
|
49
|
+
* @modified 2022-08-23 Fixed a type issue in the `setConfiguration` function.
|
|
50
|
+
* @modified 2022-08-23 Fixed a type issue in the `path` function.
|
|
51
|
+
* @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
|
|
52
|
+
* @modified 2023-09-29 Removed unused method stub for texturedPoly helper function (cleanup).
|
|
53
|
+
* @modified 2023-09-29 Downgrading all `Vertex` param type to the more generic `XYCoords` type in these render functions: line, arrow, texturedPoly, cubicBezier, cubicBezierPath, handle, handleLine, dot, point, circle, circleArc, ellipse, grid, raster.
|
|
54
|
+
* @modified 2023-09-29 Added the `headLength` parameter to the 'DrawLib.arrow()` function.
|
|
55
|
+
* @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
|
|
56
|
+
* @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
|
|
57
|
+
* @modified 2023-09-29 Added the `lineDashes` attribute.
|
|
58
|
+
* @modified 2023-09-30 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
|
|
59
|
+
* @modified 2023-10-07 Adding the optional `arrowHeadBasePositionBuffer` param to the arrowHead(...) method.
|
|
60
|
+
* @modified 2024-09-13 Remoed the scaling of `lineWidth` in the `polygon` and `polyline` methods. This makes no sense here and doesn't match up with the behavior of other line functions.
|
|
61
|
+
* @modified 2026-01-04 Adding `lineJoin` attribute to the `StrokeOptions`.
|
|
62
|
+
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
63
|
+
* @version 1.14.0
|
|
64
|
+
**/
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.drawutils = void 0;
|
|
67
|
+
var CubicBezierCurve_1 = require("./CubicBezierCurve");
|
|
68
|
+
var Vertex_1 = require("./Vertex");
|
|
69
|
+
var drawutilssvg_1 = require("./drawutilssvg");
|
|
70
|
+
var Vector_1 = require("./Vector");
|
|
71
|
+
// Todo: rename this class to Drawutils?
|
|
72
|
+
/**
|
|
73
|
+
* @classdesc A wrapper class for basic drawing operations.
|
|
74
|
+
*
|
|
75
|
+
* @requires CubicBzierCurvce
|
|
76
|
+
* @requires Polygon
|
|
77
|
+
* @requires Vertex
|
|
78
|
+
* @requires XYCoords
|
|
79
|
+
*/
|
|
80
|
+
var drawutils = /** @class */ (function () {
|
|
81
|
+
/**
|
|
82
|
+
* The constructor.
|
|
83
|
+
*
|
|
84
|
+
* @constructor
|
|
85
|
+
* @name drawutils
|
|
86
|
+
* @param {anvasRenderingContext2D} context - The drawing context.
|
|
87
|
+
* @param {boolean} fillShaped - Indicates if the constructed drawutils should fill all drawn shapes (if possible).
|
|
88
|
+
**/
|
|
89
|
+
function drawutils(context, fillShapes) {
|
|
90
|
+
this.ctx = context;
|
|
91
|
+
// this.lineDash = [];
|
|
92
|
+
this.offset = new Vertex_1.Vertex(0, 0);
|
|
93
|
+
this.scale = new Vertex_1.Vertex(1, 1);
|
|
94
|
+
this.fillShapes = fillShapes;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A private helper method to apply stroke options to the current
|
|
98
|
+
* context.
|
|
99
|
+
* @param {StrokeOptions=} strokeOptions -
|
|
100
|
+
*/
|
|
101
|
+
drawutils.prototype.applyStrokeOpts = function (strokeOptions) {
|
|
102
|
+
var _this = this;
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
this.ctx.setLineDash(((_a = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashArray) !== null && _a !== void 0 ? _a : []).map(function (dashArrayElem) {
|
|
105
|
+
// Note assume scale.x === scale.y
|
|
106
|
+
// Invariant scale makes funny stuff anyway.
|
|
107
|
+
return dashArrayElem * _this.scale.x;
|
|
108
|
+
}));
|
|
109
|
+
this.ctx.lineDashOffset = ((_b = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashOffset) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
|
|
110
|
+
this.ctx.lineJoin = (_c = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.lineJoin) !== null && _c !== void 0 ? _c : null;
|
|
111
|
+
};
|
|
112
|
+
// +---------------------------------------------------------------------------------
|
|
113
|
+
// | This is the final helper function for drawing and filling stuff. It is not
|
|
114
|
+
// | intended to be used from the outside.
|
|
115
|
+
// |
|
|
116
|
+
// | When in draw mode it draws the current shape.
|
|
117
|
+
// | When in fill mode it fills the current shape.
|
|
118
|
+
// |
|
|
119
|
+
// | This function is usually only called internally.
|
|
120
|
+
// |
|
|
121
|
+
// | @param color A stroke/fill color to use.
|
|
122
|
+
// +-------------------------------
|
|
123
|
+
// TODO: convert this to a STATIC function.
|
|
124
|
+
drawutils.prototype._fillOrDraw = function (color) {
|
|
125
|
+
if (this.fillShapes) {
|
|
126
|
+
this.ctx.fillStyle = color;
|
|
127
|
+
this.ctx.fill();
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.ctx.strokeStyle = color;
|
|
131
|
+
this.ctx.stroke();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Called before each draw cycle.
|
|
136
|
+
* @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).
|
|
137
|
+
**/
|
|
138
|
+
drawutils.prototype.beginDrawCycle = function (renderTime) {
|
|
139
|
+
// NOOP
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Called after each draw cycle.
|
|
143
|
+
*
|
|
144
|
+
* This is required for compatibility with other draw classes in the library (like drawgl).
|
|
145
|
+
*
|
|
146
|
+
* @name endDrawCycle
|
|
147
|
+
* @method
|
|
148
|
+
* @param {number} renderTime
|
|
149
|
+
* @instance
|
|
150
|
+
**/
|
|
151
|
+
drawutils.prototype.endDrawCycle = function (renderTime) {
|
|
152
|
+
// NOOP
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Set the current drawlib configuration.
|
|
156
|
+
*
|
|
157
|
+
* @name setConfiguration
|
|
158
|
+
* @method
|
|
159
|
+
* @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.
|
|
160
|
+
*/
|
|
161
|
+
drawutils.prototype.setConfiguration = function (configuration) {
|
|
162
|
+
this.ctx.globalCompositeOperation = configuration.blendMode || "source-over";
|
|
163
|
+
};
|
|
164
|
+
// /**
|
|
165
|
+
// * Set or clear the line-dash configuration. Pass `null` for un-dashed lines.
|
|
166
|
+
// *
|
|
167
|
+
// * See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray
|
|
168
|
+
// * and https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
|
|
169
|
+
// * for how line dashes work.
|
|
170
|
+
// *
|
|
171
|
+
// * @method
|
|
172
|
+
// * @param {Array<number> lineDashes - The line-dash array configuration.
|
|
173
|
+
// * @returns {void}
|
|
174
|
+
// */
|
|
175
|
+
// setLineDash(lineDash: Array<number>) {
|
|
176
|
+
// this.lineDash = lineDash;
|
|
177
|
+
// }
|
|
178
|
+
/**
|
|
179
|
+
* This method shouled be called each time the currently drawn `Drawable` changes.
|
|
180
|
+
* It is used by some libraries for identifying elemente on re-renders.
|
|
181
|
+
*
|
|
182
|
+
* @name setCurrentId
|
|
183
|
+
* @method
|
|
184
|
+
* @param {UID|null} uid - A UID identifying the currently drawn element(s).
|
|
185
|
+
**/
|
|
186
|
+
drawutils.prototype.setCurrentId = function (uid) {
|
|
187
|
+
// NOOP
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* This method shouled be called each time the currently drawn `Drawable` changes.
|
|
191
|
+
* Determine the class name for further usage here.
|
|
192
|
+
*
|
|
193
|
+
* @name setCurrentClassName
|
|
194
|
+
* @method
|
|
195
|
+
* @param {string|null} className - A class name for further custom use cases.
|
|
196
|
+
**/
|
|
197
|
+
drawutils.prototype.setCurrentClassName = function (className) {
|
|
198
|
+
// NOOP
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Draw the line between the given two points with the specified (CSS-) color.
|
|
202
|
+
*
|
|
203
|
+
* @method line
|
|
204
|
+
* @param {XYCoords} zA - The start point of the line.
|
|
205
|
+
* @param {XYCoords} zB - The end point of the line.
|
|
206
|
+
* @param {string} color - Any valid CSS color string.
|
|
207
|
+
* @param {number} lineWidth? - [optional] The line's width.
|
|
208
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
209
|
+
*
|
|
210
|
+
* @return {void}
|
|
211
|
+
* @instance
|
|
212
|
+
* @memberof drawutils
|
|
213
|
+
**/
|
|
214
|
+
drawutils.prototype.line = function (zA, zB, color, lineWidth, strokeOptions) {
|
|
215
|
+
this.ctx.save();
|
|
216
|
+
this.ctx.beginPath();
|
|
217
|
+
this.applyStrokeOpts(strokeOptions);
|
|
218
|
+
this.ctx.moveTo(this.offset.x + zA.x * this.scale.x, this.offset.y + zA.y * this.scale.y);
|
|
219
|
+
this.ctx.lineTo(this.offset.x + zB.x * this.scale.x, this.offset.y + zB.y * this.scale.y);
|
|
220
|
+
this.ctx.strokeStyle = color;
|
|
221
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
222
|
+
this.ctx.stroke();
|
|
223
|
+
this.ctx.restore();
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
227
|
+
*
|
|
228
|
+
* @method arrow
|
|
229
|
+
* @param {XYCoords} zA - The start point of the arrow-line.
|
|
230
|
+
* @param {XYCoords} zB - The end point of the arrow-line.
|
|
231
|
+
* @param {string} color - Any valid CSS color string.
|
|
232
|
+
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
233
|
+
* @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
|
|
234
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
235
|
+
*
|
|
236
|
+
* @return {void}
|
|
237
|
+
* @instance
|
|
238
|
+
* @memberof drawutils
|
|
239
|
+
**/
|
|
240
|
+
drawutils.prototype.arrow = function (zA, zB, color, lineWidth, headLength, strokeOptions) {
|
|
241
|
+
if (headLength === void 0) { headLength = 8; }
|
|
242
|
+
var arrowHeadBasePosition = new Vertex_1.Vertex(0, 0);
|
|
243
|
+
this.arrowHead(zA, zB, color, lineWidth, headLength, undefined, arrowHeadBasePosition); // Will NOT use dash configuration
|
|
244
|
+
this.line(zA, arrowHeadBasePosition, color, lineWidth, strokeOptions); // Will use dash configuration
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Draw a cubic Bézier curve and and an arrow at the end (endControlPoint) of the given line width the specified (CSS-) color and arrow size.
|
|
248
|
+
*
|
|
249
|
+
* @method cubicBezierArrow
|
|
250
|
+
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
251
|
+
* @param {XYCoords} endPoint - The end point the cubic Bézier curve.
|
|
252
|
+
* @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
|
|
253
|
+
* @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
|
|
254
|
+
* @param {string} color - The CSS color to draw the curve with.
|
|
255
|
+
* @param {number} lineWidth - (optional) The line width to use.
|
|
256
|
+
* @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
|
|
257
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
258
|
+
*
|
|
259
|
+
* @return {void}
|
|
260
|
+
* @instance
|
|
261
|
+
* @memberof DrawLib
|
|
262
|
+
*/
|
|
263
|
+
drawutils.prototype.cubicBezierArrow = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, headLength, strokeOptions) {
|
|
264
|
+
var arrowHeadBasePosition = new Vertex_1.Vertex(0, 0);
|
|
265
|
+
// Will NOT use dash configuration
|
|
266
|
+
this.arrowHead(endControlPoint, endPoint, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
|
|
267
|
+
var diff = arrowHeadBasePosition.difference(endPoint);
|
|
268
|
+
// Will use dash configuration
|
|
269
|
+
this.cubicBezier(startPoint, { x: endPoint.x - diff.x, y: endPoint.y - diff.y }, startControlPoint, { x: endControlPoint.x - diff.x, y: endControlPoint.y - diff.y }, color, lineWidth, strokeOptions);
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
|
|
273
|
+
*
|
|
274
|
+
* @method arrow
|
|
275
|
+
* @param {XYCoords} zA - The start point of the arrow-line.
|
|
276
|
+
* @param {XYCoords} zB - The end point of the arrow-line.
|
|
277
|
+
* @param {string} color - Any valid CSS color string.
|
|
278
|
+
* @param {number=1} lineWidth - (optional) The line width to use; default is 1.
|
|
279
|
+
* @param {number=8} headLength - (optional) The length of the arrow head (default is 8 pixels).
|
|
280
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
281
|
+
* @param {XYCoords=} arrowHeadBasePositionBuffer - (optional) If not null, then this position will contain the arrow head's start point (after execution). Some sort of OUT variable.
|
|
282
|
+
*
|
|
283
|
+
* @return {void}
|
|
284
|
+
* @instance
|
|
285
|
+
* @memberof DrawLib
|
|
286
|
+
**/
|
|
287
|
+
drawutils.prototype.arrowHead = function (zA, zB, color, lineWidth, headLength, strokeOptions, arrowHeadBasePositionBuffer) {
|
|
288
|
+
// var headLength: number = 8; // length of head in pixels
|
|
289
|
+
if (headLength === void 0) { headLength = 8; }
|
|
290
|
+
this.ctx.save();
|
|
291
|
+
this.ctx.beginPath();
|
|
292
|
+
this.applyStrokeOpts(strokeOptions);
|
|
293
|
+
var vertices = Vector_1.Vector.utils.buildArrowHead(zA, zB, headLength, this.scale.x, this.scale.y);
|
|
294
|
+
if (arrowHeadBasePositionBuffer) {
|
|
295
|
+
arrowHeadBasePositionBuffer.x = vertices[0].x / this.scale.x;
|
|
296
|
+
arrowHeadBasePositionBuffer.y = vertices[0].y / this.scale.y;
|
|
297
|
+
}
|
|
298
|
+
this.ctx.moveTo(this.offset.x + vertices[0].x, this.offset.y + vertices[0].y);
|
|
299
|
+
for (var i = 0; i < vertices.length; i++) {
|
|
300
|
+
this.ctx.lineTo(this.offset.x + vertices[i].x, this.offset.y + vertices[i].y);
|
|
301
|
+
}
|
|
302
|
+
this.ctx.lineTo(this.offset.x + vertices[0].x, this.offset.y + vertices[0].y);
|
|
303
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
304
|
+
this._fillOrDraw(color);
|
|
305
|
+
this.ctx.restore();
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Draw an image at the given position with the given size.<br>
|
|
309
|
+
* <br>
|
|
310
|
+
* Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
311
|
+
*
|
|
312
|
+
* @method image
|
|
313
|
+
* @param {Image} image - The image object to draw.
|
|
314
|
+
* @param {XYCoords} position - The position to draw the the upper left corner at.
|
|
315
|
+
* @param {XYCoords} size - The x/y-size to draw the image with.
|
|
316
|
+
* @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
|
|
317
|
+
* @return {void}
|
|
318
|
+
* @instance
|
|
319
|
+
* @memberof drawutils
|
|
320
|
+
**/
|
|
321
|
+
drawutils.prototype.image = function (image, position, size, alpha) {
|
|
322
|
+
if (alpha === void 0) { alpha = 1.0; }
|
|
323
|
+
if (!image.complete || !image.naturalWidth) {
|
|
324
|
+
// Avoid drawing un-unloaded or broken images
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
this.ctx.save();
|
|
328
|
+
this.ctx.globalAlpha = alpha;
|
|
329
|
+
// Note that there is a Safari bug with the 3 or 5 params variant.
|
|
330
|
+
// Only the 9-param varaint works.
|
|
331
|
+
this.ctx.drawImage(image, 0, 0, image.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
|
|
332
|
+
image.naturalHeight - 1, // To avoid errors substract 1 here.
|
|
333
|
+
this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y, size.x * this.scale.x, size.y * this.scale.y);
|
|
334
|
+
this.ctx.restore();
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Draw an image at the given position with the given size.<br>
|
|
338
|
+
* <br>
|
|
339
|
+
* Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
340
|
+
*
|
|
341
|
+
* @method texturedPoly
|
|
342
|
+
* @param {Image} textureImage - The image object to draw.
|
|
343
|
+
* @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
|
|
344
|
+
* @param {Polygon} polygon - The polygon to use as clip path.
|
|
345
|
+
* @param {XYCoords} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
|
|
346
|
+
* @param {number} rotation - The rotation to use for the polygon (and for the texture).
|
|
347
|
+
* @param {XYCoords={x:0,y:0}} rotationCenter - (optional) The rotational center; default is center of bounding box.
|
|
348
|
+
* @return {void}
|
|
349
|
+
* @instance
|
|
350
|
+
* @memberof drawutils
|
|
351
|
+
**/
|
|
352
|
+
drawutils.prototype.texturedPoly = function (textureImage, textureSize, polygon, polygonPosition, rotation) {
|
|
353
|
+
var basePolygonBounds = polygon.getBounds();
|
|
354
|
+
// var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());
|
|
355
|
+
var targetCenterDifference = new Vertex_1.Vertex(polygonPosition.x, polygonPosition.y).difference(basePolygonBounds.getCenter());
|
|
356
|
+
// var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);
|
|
357
|
+
// Get the position offset of the polygon
|
|
358
|
+
var targetTextureSize = new Vertex_1.Vertex(textureSize.width, textureSize.height);
|
|
359
|
+
// var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);
|
|
360
|
+
var targetTextureOffset = new Vertex_1.Vertex(textureSize.min.x, textureSize.min.y).sub(polygonPosition);
|
|
361
|
+
this.ctx.save();
|
|
362
|
+
// this.ctx.translate(this.offset.x + rotationCenter.x * this.scale.x, this.offset.y + rotationCenter.y * this.scale.y);
|
|
363
|
+
this.ctx.translate(this.offset.x + polygonPosition.x * this.scale.x, this.offset.y + polygonPosition.y * this.scale.y);
|
|
364
|
+
drawutils.helpers.clipPoly(this.ctx, {
|
|
365
|
+
x: -polygonPosition.x * this.scale.x,
|
|
366
|
+
y: -polygonPosition.y * this.scale.y
|
|
367
|
+
}, this.scale, polygon.vertices);
|
|
368
|
+
this.ctx.scale(this.scale.x, this.scale.y);
|
|
369
|
+
this.ctx.rotate(rotation);
|
|
370
|
+
this.ctx.drawImage(textureImage, 0, 0, textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
|
|
371
|
+
textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
|
|
372
|
+
targetTextureOffset.x, // * this.scale.x,
|
|
373
|
+
targetTextureOffset.y, // * this.scale.y,
|
|
374
|
+
targetTextureSize.x, // * this.scale.x,
|
|
375
|
+
targetTextureSize.y // * this.scale.y
|
|
376
|
+
);
|
|
377
|
+
this.ctx.restore();
|
|
378
|
+
};
|
|
379
|
+
/*
|
|
380
|
+
_texturedPoly(
|
|
381
|
+
textureImage: HTMLImageElement,
|
|
382
|
+
textureSize: Bounds,
|
|
383
|
+
polygon: Polygon,
|
|
384
|
+
polygonPosition: XYCoords,
|
|
385
|
+
rotation: number,
|
|
386
|
+
rotationCenter: XYCoords = { x: 0, y: 0 }
|
|
387
|
+
): void {
|
|
388
|
+
var basePolygonBounds = polygon.getBounds();
|
|
389
|
+
var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());
|
|
390
|
+
var rotationalOffset = rotationCenter ? polygonPosition.difference(rotationCenter) : { x: 0, y: 0 };
|
|
391
|
+
// var rotationalOffset = { x: 0, y: 0 };
|
|
392
|
+
var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);
|
|
393
|
+
|
|
394
|
+
// Get the position offset of the polygon
|
|
395
|
+
var targetTextureSize = new Vertex(textureSize.width, textureSize.height);
|
|
396
|
+
var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);
|
|
397
|
+
|
|
398
|
+
this.ctx.save();
|
|
399
|
+
|
|
400
|
+
// this.ctx.translate(
|
|
401
|
+
// this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x,
|
|
402
|
+
// this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y
|
|
403
|
+
// );
|
|
404
|
+
this.ctx.translate(
|
|
405
|
+
this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x,
|
|
406
|
+
this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y
|
|
407
|
+
);
|
|
408
|
+
this.ctx.rotate(rotation);
|
|
409
|
+
|
|
410
|
+
drawutils.helpers.clipPoly(
|
|
411
|
+
this.ctx,
|
|
412
|
+
{
|
|
413
|
+
x: (-targetCenterDifference.x * 1 - tileCenter.x - rotationalOffset.x) * this.scale.x,
|
|
414
|
+
y: (-targetCenterDifference.y * 1 - tileCenter.y - rotationalOffset.y) * this.scale.y
|
|
415
|
+
},
|
|
416
|
+
this.scale,
|
|
417
|
+
polygon.vertices
|
|
418
|
+
);
|
|
419
|
+
this.ctx.drawImage(
|
|
420
|
+
textureImage,
|
|
421
|
+
0,
|
|
422
|
+
0,
|
|
423
|
+
textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
|
|
424
|
+
textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
|
|
425
|
+
(-polygonPosition.x + targetTextureOffset.x * 1 - rotationalOffset.x * 1) * this.scale.x,
|
|
426
|
+
(-polygonPosition.y + targetTextureOffset.y * 1 - rotationalOffset.y * 1) * this.scale.y,
|
|
427
|
+
targetTextureSize.x * this.scale.x,
|
|
428
|
+
targetTextureSize.y * this.scale.y
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// const scaledTextureSize = new Bounds(
|
|
432
|
+
// new Vertex(
|
|
433
|
+
// -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x,
|
|
434
|
+
// -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y
|
|
435
|
+
// ).scaleXY(this.scale, rotationCenter),
|
|
436
|
+
// new Vertex(
|
|
437
|
+
// -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x + targetTextureSize.x,
|
|
438
|
+
// -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y + targetTextureSize.y
|
|
439
|
+
// ).scaleXY(this.scale, rotationCenter)
|
|
440
|
+
// );
|
|
441
|
+
// this.ctx.drawImage(
|
|
442
|
+
// textureImage,
|
|
443
|
+
// 0,
|
|
444
|
+
// 0,
|
|
445
|
+
// textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
|
|
446
|
+
// textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
|
|
447
|
+
// scaledTextureSize.min.x,
|
|
448
|
+
// scaledTextureSize.min.y,
|
|
449
|
+
// scaledTextureSize.width,
|
|
450
|
+
// scaledTextureSize.height
|
|
451
|
+
// );
|
|
452
|
+
|
|
453
|
+
this.ctx.restore();
|
|
454
|
+
}
|
|
455
|
+
*/
|
|
456
|
+
/**
|
|
457
|
+
* Draw a rectangle.
|
|
458
|
+
*
|
|
459
|
+
* @param {XYCoords} position - The upper left corner of the rectangle.
|
|
460
|
+
* @param {number} width - The width of the rectangle.
|
|
461
|
+
* @param {number} height - The height of the rectangle.
|
|
462
|
+
* @param {string} color - The color to use.
|
|
463
|
+
* @param {number=1} lineWidth - (optional) The line with to use (default is 1).
|
|
464
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
465
|
+
*
|
|
466
|
+
* @return {void}
|
|
467
|
+
* @instance
|
|
468
|
+
* @memberof drawutils
|
|
469
|
+
**/
|
|
470
|
+
drawutils.prototype.rect = function (position, width, height, color, lineWidth, strokeOptions) {
|
|
471
|
+
this.ctx.save();
|
|
472
|
+
this.ctx.beginPath();
|
|
473
|
+
this.applyStrokeOpts(strokeOptions);
|
|
474
|
+
this.ctx.moveTo(this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y);
|
|
475
|
+
this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + position.y * this.scale.y);
|
|
476
|
+
this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);
|
|
477
|
+
this.ctx.lineTo(this.offset.x + position.x * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);
|
|
478
|
+
// this.ctx.lineTo( this.offset.x+position.x*this.scale.x, this.offset.y+position.y*this.scale.y );
|
|
479
|
+
this.ctx.closePath();
|
|
480
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
481
|
+
this._fillOrDraw(color);
|
|
482
|
+
this.ctx.restore();
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Draw the given (cubic) bézier curve.
|
|
486
|
+
*
|
|
487
|
+
* @method cubicBezier
|
|
488
|
+
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
489
|
+
* @param {XYCoords} endPoint - The end point the cubic Bézier curve.
|
|
490
|
+
* @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
|
|
491
|
+
* @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
|
|
492
|
+
* @param {string} color - The CSS color to draw the curve with.
|
|
493
|
+
* @param {number} lineWidth - (optional) The line width to use.
|
|
494
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
495
|
+
*
|
|
496
|
+
* @return {void}
|
|
497
|
+
* @instance
|
|
498
|
+
* @memberof drawutils
|
|
499
|
+
*/
|
|
500
|
+
drawutils.prototype.cubicBezier = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
|
|
501
|
+
if (startPoint instanceof CubicBezierCurve_1.CubicBezierCurve) {
|
|
502
|
+
this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
// Draw curve
|
|
506
|
+
this.ctx.save();
|
|
507
|
+
this.ctx.beginPath();
|
|
508
|
+
this.applyStrokeOpts(strokeOptions);
|
|
509
|
+
this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);
|
|
510
|
+
this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
|
|
511
|
+
//this.ctx.closePath();
|
|
512
|
+
this.ctx.lineWidth = lineWidth || 2;
|
|
513
|
+
this._fillOrDraw(color);
|
|
514
|
+
this.ctx.restore();
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
517
|
+
* Draw the given (quadratic) bézier curve.
|
|
518
|
+
*
|
|
519
|
+
* @method quadraticBezier
|
|
520
|
+
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
521
|
+
* @param {XYCoords} controlPoint - The control point the cubic Bézier curve.
|
|
522
|
+
* @param {XYCoords} endPoint - The end control point the cubic Bézier curve.
|
|
523
|
+
* @param {string} color - The CSS color to draw the curve with.
|
|
524
|
+
* @param {number|string} lineWidth - (optional) The line width to use.
|
|
525
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
526
|
+
*
|
|
527
|
+
* @return {void}
|
|
528
|
+
* @instance
|
|
529
|
+
* @memberof drawutils
|
|
530
|
+
*/
|
|
531
|
+
drawutils.prototype.quadraticBezier = function (startPoint, controlPoint, endPoint, color, lineWidth, strokeOptions) {
|
|
532
|
+
// Draw curve
|
|
533
|
+
this.ctx.save();
|
|
534
|
+
this.ctx.beginPath();
|
|
535
|
+
this.applyStrokeOpts(strokeOptions);
|
|
536
|
+
this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);
|
|
537
|
+
this.ctx.quadraticCurveTo(this.offset.x + controlPoint.x * this.scale.x, this.offset.y + controlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
|
|
538
|
+
this.ctx.lineWidth = lineWidth || 2;
|
|
539
|
+
this._fillOrDraw(color);
|
|
540
|
+
this.ctx.restore();
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Draw the given (cubic) Bézier path.
|
|
544
|
+
*
|
|
545
|
+
* The given path must be an array with n*3+1 vertices, where n is the number of
|
|
546
|
+
* curves in the path:
|
|
547
|
+
* <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
|
|
548
|
+
*
|
|
549
|
+
* @method cubicBezierPath
|
|
550
|
+
* @param {XYCoords[]} path - The cubic bezier path as described above.
|
|
551
|
+
* @param {string} color - The CSS colot to draw the path with.
|
|
552
|
+
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
553
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
554
|
+
*
|
|
555
|
+
* @return {void}
|
|
556
|
+
* @instance
|
|
557
|
+
* @memberof drawutils
|
|
558
|
+
*/
|
|
559
|
+
drawutils.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions, isOpen) {
|
|
560
|
+
if (!path || path.length == 0) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
// Draw curve
|
|
564
|
+
this.ctx.save();
|
|
565
|
+
this.ctx.beginPath();
|
|
566
|
+
var endPoint;
|
|
567
|
+
var startControlPoint;
|
|
568
|
+
var endControlPoint;
|
|
569
|
+
this.applyStrokeOpts(strokeOptions);
|
|
570
|
+
this.ctx.moveTo(this.offset.x + path[0].x * this.scale.x, this.offset.y + path[0].y * this.scale.y);
|
|
571
|
+
for (var i = 1; i < path.length; i += 3) {
|
|
572
|
+
startControlPoint = path[i];
|
|
573
|
+
endControlPoint = path[i + 1];
|
|
574
|
+
endPoint = path[i + 2];
|
|
575
|
+
this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
|
|
576
|
+
}
|
|
577
|
+
if (!isOpen) {
|
|
578
|
+
this.ctx.closePath();
|
|
579
|
+
}
|
|
580
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
581
|
+
this._fillOrDraw(color);
|
|
582
|
+
this.ctx.restore();
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Draw the given handle and handle point (used to draw interactive Bézier curves).
|
|
586
|
+
*
|
|
587
|
+
* The colors for this are fixed and cannot be specified.
|
|
588
|
+
*
|
|
589
|
+
* @method handle
|
|
590
|
+
* @param {XYCoords} startPoint - The start of the handle.
|
|
591
|
+
* @param {XYCoords} endPoint - The end point of the handle.
|
|
592
|
+
* @return {void}
|
|
593
|
+
* @instance
|
|
594
|
+
* @memberof drawutils
|
|
595
|
+
*/
|
|
596
|
+
drawutils.prototype.handle = function (startPoint, endPoint) {
|
|
597
|
+
// Draw handles
|
|
598
|
+
// (No need to save and restore here)
|
|
599
|
+
this.point(startPoint, "rgb(0,32,192)");
|
|
600
|
+
this.square(endPoint, 5, "rgba(0,128,192,0.5)");
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Draw a handle line (with a light grey).
|
|
604
|
+
*
|
|
605
|
+
* @method handleLine
|
|
606
|
+
* @param {XYCoords} startPoint - The start point to draw the handle at.
|
|
607
|
+
* @param {XYCoords} endPoint - The end point to draw the handle at.
|
|
608
|
+
* @return {void}
|
|
609
|
+
* @instance
|
|
610
|
+
* @memberof drawutils
|
|
611
|
+
*/
|
|
612
|
+
drawutils.prototype.handleLine = function (startPoint, endPoint) {
|
|
613
|
+
// Draw handle lines
|
|
614
|
+
this.line(startPoint, endPoint, "rgba(128,128,128, 0.5)", undefined);
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Draw a 1x1 dot with the specified (CSS-) color.
|
|
618
|
+
*
|
|
619
|
+
* @method dot
|
|
620
|
+
* @param {XYCoords} p - The position to draw the dot at.
|
|
621
|
+
* @param {string} color - The CSS color to draw the dot with.
|
|
622
|
+
* @return {void}
|
|
623
|
+
* @instance
|
|
624
|
+
* @memberof drawutils
|
|
625
|
+
*/
|
|
626
|
+
drawutils.prototype.dot = function (p, color) {
|
|
627
|
+
this.ctx.save();
|
|
628
|
+
this.ctx.beginPath();
|
|
629
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
630
|
+
this.ctx.moveTo(Math.round(this.offset.x + this.scale.x * p.x), Math.round(this.offset.y + this.scale.y * p.y));
|
|
631
|
+
this.ctx.lineTo(Math.round(this.offset.x + this.scale.x * p.x + 1), Math.round(this.offset.y + this.scale.y * p.y + 1));
|
|
632
|
+
this.ctx.closePath();
|
|
633
|
+
this.ctx.lineWidth = 1;
|
|
634
|
+
this._fillOrDraw(color);
|
|
635
|
+
this.ctx.restore();
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Draw the given point with the specified (CSS-) color and radius 3.
|
|
639
|
+
*
|
|
640
|
+
* @method point
|
|
641
|
+
* @param {XYCoords} p - The position to draw the point at.
|
|
642
|
+
* @param {string} color - The CSS color to draw the point with.
|
|
643
|
+
* @return {void}
|
|
644
|
+
* @instance
|
|
645
|
+
* @memberof drawutils
|
|
646
|
+
*/
|
|
647
|
+
drawutils.prototype.point = function (p, color) {
|
|
648
|
+
var radius = 3;
|
|
649
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
650
|
+
this.ctx.beginPath();
|
|
651
|
+
this.ctx.arc(this.offset.x + p.x * this.scale.x, this.offset.y + p.y * this.scale.y, radius, 0, 2 * Math.PI, false);
|
|
652
|
+
this.ctx.closePath();
|
|
653
|
+
this.ctx.lineWidth = 1;
|
|
654
|
+
this._fillOrDraw(color);
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* Draw a circle with the specified (CSS-) color and radius.<br>
|
|
658
|
+
* <br>
|
|
659
|
+
* Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
|
|
660
|
+
*
|
|
661
|
+
* @method circle
|
|
662
|
+
* @param {XYCoords} center - The center of the circle.
|
|
663
|
+
* @param {number} radius - The radius of the circle.
|
|
664
|
+
* @param {string} color - The CSS color to draw the circle with.
|
|
665
|
+
* @param {number} lineWidth - The line width (optional, default=1).
|
|
666
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
667
|
+
*
|
|
668
|
+
* @return {void}
|
|
669
|
+
* @instance
|
|
670
|
+
* @memberof drawutils
|
|
671
|
+
*/
|
|
672
|
+
drawutils.prototype.circle = function (center, radius, color, lineWidth, strokeOptions) {
|
|
673
|
+
this.applyStrokeOpts(strokeOptions);
|
|
674
|
+
this.ctx.beginPath();
|
|
675
|
+
this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, 0.0, Math.PI * 2);
|
|
676
|
+
this.ctx.closePath();
|
|
677
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
678
|
+
this._fillOrDraw(color);
|
|
679
|
+
};
|
|
680
|
+
/**
|
|
681
|
+
* Draw a circular arc (section of a circle) with the given CSS color.
|
|
682
|
+
*
|
|
683
|
+
* @method circleArc
|
|
684
|
+
* @param {XYCoords} center - The center of the circle.
|
|
685
|
+
* @param {number} radius - The radius of the circle.
|
|
686
|
+
* @param {number} startAngle - The angle to start at.
|
|
687
|
+
* @param {number} endAngle - The angle to end at.
|
|
688
|
+
* @param {string=#000000} color - The CSS color to draw the circle with.
|
|
689
|
+
* @param {number=1} lineWidth - The line width to use
|
|
690
|
+
* @param {boolean=false} options.asSegment - If `true` then no beginPath and no draw will be applied (as part of larger path).
|
|
691
|
+
* @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
|
|
692
|
+
* @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
|
|
693
|
+
*
|
|
694
|
+
* @return {void}
|
|
695
|
+
* @instance
|
|
696
|
+
* @memberof drawutils
|
|
697
|
+
*/
|
|
698
|
+
drawutils.prototype.circleArc = function (center, radius, startAngle, endAngle, color, lineWidth, options) {
|
|
699
|
+
if (!options || !options.asSegment) {
|
|
700
|
+
this.ctx.beginPath();
|
|
701
|
+
}
|
|
702
|
+
this.applyStrokeOpts(options);
|
|
703
|
+
this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, startAngle, endAngle, false);
|
|
704
|
+
if (!options || !options.asSegment) {
|
|
705
|
+
// this.ctx.closePath();
|
|
706
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
707
|
+
this._fillOrDraw(color || "#000000");
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* Draw an ellipse with the specified (CSS-) color and thw two radii.
|
|
712
|
+
*
|
|
713
|
+
* @method ellipse
|
|
714
|
+
* @param {XYCoords} center - The center of the ellipse.
|
|
715
|
+
* @param {number} radiusX - The radius of the ellipse.
|
|
716
|
+
* @param {number} radiusY - The radius of the ellipse.
|
|
717
|
+
* @param {string} color - The CSS color to draw the ellipse with.
|
|
718
|
+
* @param {number} lineWidth=1 - An optional line width param (default is 1).
|
|
719
|
+
* @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
|
|
720
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
721
|
+
*
|
|
722
|
+
* @return {void}
|
|
723
|
+
* @instance
|
|
724
|
+
* @memberof drawutils
|
|
725
|
+
*/
|
|
726
|
+
drawutils.prototype.ellipse = function (center, radiusX, radiusY, color, lineWidth, rotation, strokeOptions) {
|
|
727
|
+
if (typeof rotation === "undefined") {
|
|
728
|
+
rotation = 0.0;
|
|
729
|
+
}
|
|
730
|
+
this.applyStrokeOpts(strokeOptions);
|
|
731
|
+
this.ctx.beginPath();
|
|
732
|
+
this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radiusX * this.scale.x, radiusY * this.scale.y, rotation, 0.0, Math.PI * 2);
|
|
733
|
+
this.ctx.closePath();
|
|
734
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
735
|
+
this._fillOrDraw(color);
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* Draw square at the given center, size and with the specified (CSS-) color.<br>
|
|
739
|
+
* <br>
|
|
740
|
+
* Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.
|
|
741
|
+
*
|
|
742
|
+
* @method square
|
|
743
|
+
* @param {XYCoords} center - The center of the square.
|
|
744
|
+
* @param {number} size - The size of the square.
|
|
745
|
+
* @param {string} color - The CSS color to draw the square with.
|
|
746
|
+
* @param {number} lineWidth - The line with to use (optional, default is 1).
|
|
747
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
748
|
+
*
|
|
749
|
+
* @return {void}
|
|
750
|
+
* @instance
|
|
751
|
+
* @memberof drawutils
|
|
752
|
+
*/
|
|
753
|
+
drawutils.prototype.square = function (center, size, color, lineWidth, strokeOptions) {
|
|
754
|
+
this.applyStrokeOpts(strokeOptions);
|
|
755
|
+
this.ctx.beginPath();
|
|
756
|
+
this.ctx.rect(this.offset.x + (center.x - size / 2.0) * this.scale.x, this.offset.y + (center.y - size / 2.0) * this.scale.y, size * this.scale.x, size * this.scale.y);
|
|
757
|
+
this.ctx.closePath();
|
|
758
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
759
|
+
this._fillOrDraw(color);
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Draw a grid of horizontal and vertical lines with the given (CSS-) color.
|
|
763
|
+
*
|
|
764
|
+
* @method grid
|
|
765
|
+
* @param {XYCoords} center - The center of the grid.
|
|
766
|
+
* @param {number} width - The total width of the grid (width/2 each to the left and to the right).
|
|
767
|
+
* @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
|
|
768
|
+
* @param {number} sizeX - The horizontal grid size.
|
|
769
|
+
* @param {number} sizeY - The vertical grid size.
|
|
770
|
+
* @param {string} color - The CSS color to draw the grid with.
|
|
771
|
+
* @return {void}
|
|
772
|
+
* @instance
|
|
773
|
+
* @memberof drawutils
|
|
774
|
+
*/
|
|
775
|
+
drawutils.prototype.grid = function (center, width, height, sizeX, sizeY, color) {
|
|
776
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
777
|
+
this.ctx.beginPath();
|
|
778
|
+
var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;
|
|
779
|
+
var yMax = height / 2;
|
|
780
|
+
for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
|
|
781
|
+
this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMin) * this.scale.y);
|
|
782
|
+
this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMax) * this.scale.y);
|
|
783
|
+
}
|
|
784
|
+
var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX; // -Math.ceil((height*0.5)/sizeY)*sizeY;
|
|
785
|
+
var xMax = width / 2; // height/2;
|
|
786
|
+
for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
|
|
787
|
+
this.ctx.moveTo(this.offset.x + (center.x + xMin) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);
|
|
788
|
+
this.ctx.lineTo(this.offset.x + (center.x + xMax) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);
|
|
789
|
+
}
|
|
790
|
+
this.ctx.strokeStyle = color;
|
|
791
|
+
this.ctx.lineWidth = 1.0;
|
|
792
|
+
this.ctx.stroke();
|
|
793
|
+
this.ctx.closePath();
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* Draw a raster of crosshairs in the given grid.<br>
|
|
797
|
+
*
|
|
798
|
+
* This works analogue to the grid() function
|
|
799
|
+
*
|
|
800
|
+
* @method raster
|
|
801
|
+
* @param {XYCoords} center - The center of the raster.
|
|
802
|
+
* @param {number} width - The total width of the raster (width/2 each to the left and to the right).
|
|
803
|
+
* @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
|
|
804
|
+
* @param {number} sizeX - The horizontal raster size.
|
|
805
|
+
* @param {number} sizeY - The vertical raster size.
|
|
806
|
+
* @param {string} color - The CSS color to draw the raster with.
|
|
807
|
+
* @return {void}
|
|
808
|
+
* @instance
|
|
809
|
+
* @memberof drawutils
|
|
810
|
+
*/
|
|
811
|
+
drawutils.prototype.raster = function (center, width, height, sizeX, sizeY, color) {
|
|
812
|
+
this.ctx.save();
|
|
813
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
814
|
+
this.ctx.beginPath();
|
|
815
|
+
for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
|
|
816
|
+
for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
|
|
817
|
+
// Draw a crosshair
|
|
818
|
+
this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);
|
|
819
|
+
this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);
|
|
820
|
+
this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y - 4);
|
|
821
|
+
this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y + 4);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
this.ctx.strokeStyle = color;
|
|
825
|
+
this.ctx.lineWidth = 1.0;
|
|
826
|
+
this.ctx.stroke();
|
|
827
|
+
this.ctx.closePath();
|
|
828
|
+
this.ctx.restore();
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* Draw a diamond handle (square rotated by 45°) with the given CSS color.
|
|
832
|
+
*
|
|
833
|
+
* It is an inherent feature of the handle functions that the drawn elements are not scaled and not
|
|
834
|
+
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
835
|
+
* as even shaped diamonds.
|
|
836
|
+
*
|
|
837
|
+
* @method diamondHandle
|
|
838
|
+
* @param {XYCoords} center - The center of the diamond.
|
|
839
|
+
* @param {number} size - The x/y-size of the diamond.
|
|
840
|
+
* @param {string} color - The CSS color to draw the diamond with.
|
|
841
|
+
* @return {void}
|
|
842
|
+
* @instance
|
|
843
|
+
* @memberof drawutils
|
|
844
|
+
*/
|
|
845
|
+
drawutils.prototype.diamondHandle = function (center, size, color) {
|
|
846
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
847
|
+
this.ctx.beginPath();
|
|
848
|
+
this.ctx.moveTo(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y);
|
|
849
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - size / 2.0);
|
|
850
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x + size / 2.0, this.offset.y + center.y * this.scale.y);
|
|
851
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + size / 2.0);
|
|
852
|
+
this.ctx.closePath();
|
|
853
|
+
this.ctx.lineWidth = 1;
|
|
854
|
+
this._fillOrDraw(color);
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* Draw a square handle with the given CSS color.<br>
|
|
858
|
+
* <br>
|
|
859
|
+
* It is an inherent feature of the handle functions that the drawn elements are not scaled and not
|
|
860
|
+
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
861
|
+
* as even shaped squares.
|
|
862
|
+
*
|
|
863
|
+
* @method squareHandle
|
|
864
|
+
* @param {XYCoords} center - The center of the square.
|
|
865
|
+
* @param {number} size - The x/y-size of the square.
|
|
866
|
+
* @param {string} color - The CSS color to draw the square with.
|
|
867
|
+
* @return {void}
|
|
868
|
+
* @instance
|
|
869
|
+
* @memberof drawutils
|
|
870
|
+
*/
|
|
871
|
+
drawutils.prototype.squareHandle = function (center, size, color) {
|
|
872
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
873
|
+
this.ctx.beginPath();
|
|
874
|
+
this.ctx.rect(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y - size / 2.0, size, size);
|
|
875
|
+
this.ctx.closePath();
|
|
876
|
+
this.ctx.lineWidth = 1;
|
|
877
|
+
this._fillOrDraw(color);
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Draw a circle handle with the given CSS color.<br>
|
|
881
|
+
* <br>
|
|
882
|
+
* It is an inherent feature of the handle functions that the drawn elements are not scaled and not
|
|
883
|
+
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
884
|
+
* as even shaped circles.
|
|
885
|
+
*
|
|
886
|
+
* @method circleHandle
|
|
887
|
+
* @param {XYCoords} center - The center of the circle.
|
|
888
|
+
* @param {number} radius - The radius of the circle.
|
|
889
|
+
* @param {string} color - The CSS color to draw the circle with.
|
|
890
|
+
* @return {void}
|
|
891
|
+
* @instance
|
|
892
|
+
* @memberof drawutils
|
|
893
|
+
*/
|
|
894
|
+
drawutils.prototype.circleHandle = function (center, radius, color) {
|
|
895
|
+
radius = radius || 3;
|
|
896
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
897
|
+
this.ctx.beginPath();
|
|
898
|
+
this.ctx.arc(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius, 0, 2 * Math.PI, false);
|
|
899
|
+
this.ctx.closePath();
|
|
900
|
+
this.ctx.lineWidth = 1;
|
|
901
|
+
this._fillOrDraw(color);
|
|
902
|
+
};
|
|
903
|
+
/**
|
|
904
|
+
* Draw a crosshair with given radius and color at the given position.<br>
|
|
905
|
+
* <br>
|
|
906
|
+
* Note that the crosshair radius will not be affected by scaling.
|
|
907
|
+
*
|
|
908
|
+
* @method crosshair
|
|
909
|
+
* @param {XYCoords} center - The center of the crosshair.
|
|
910
|
+
* @param {number} radius - The radius of the crosshair.
|
|
911
|
+
* @param {string} color - The CSS color to draw the crosshair with.
|
|
912
|
+
* @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
|
|
913
|
+
* @return {void}
|
|
914
|
+
* @instance
|
|
915
|
+
* @memberof drawutils
|
|
916
|
+
*/
|
|
917
|
+
drawutils.prototype.crosshair = function (center, radius, color, lineWidth) {
|
|
918
|
+
this.ctx.save();
|
|
919
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
920
|
+
this.ctx.beginPath();
|
|
921
|
+
this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y);
|
|
922
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y);
|
|
923
|
+
this.ctx.moveTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - radius);
|
|
924
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + radius);
|
|
925
|
+
this.ctx.strokeStyle = color;
|
|
926
|
+
this.ctx.lineWidth = lineWidth || 0.5;
|
|
927
|
+
this.ctx.stroke();
|
|
928
|
+
this.ctx.closePath();
|
|
929
|
+
this.ctx.restore();
|
|
930
|
+
};
|
|
931
|
+
/**
|
|
932
|
+
* Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
|
|
933
|
+
* <br>
|
|
934
|
+
* Note that the x's radius will not be affected by scaling.
|
|
935
|
+
*
|
|
936
|
+
* @method crosshair
|
|
937
|
+
* @param {XYCoords} center - The center of the crosshair.
|
|
938
|
+
* @param {number} radius - The radius of the crosshair.
|
|
939
|
+
* @param {string} color - The CSS color to draw the crosshair with.
|
|
940
|
+
* @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
|
|
941
|
+
* @return {void}
|
|
942
|
+
* @instance
|
|
943
|
+
* @memberof drawutils
|
|
944
|
+
*/
|
|
945
|
+
drawutils.prototype.cross = function (center, radius, color, lineWidth) {
|
|
946
|
+
this.ctx.save();
|
|
947
|
+
this.ctx.setLineDash([]); // Clear line-dash settings
|
|
948
|
+
this.ctx.beginPath();
|
|
949
|
+
this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y - radius);
|
|
950
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y + radius);
|
|
951
|
+
this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y + radius);
|
|
952
|
+
this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y - radius);
|
|
953
|
+
this.ctx.strokeStyle = color;
|
|
954
|
+
this.ctx.lineWidth = lineWidth || 1.0;
|
|
955
|
+
this.ctx.stroke();
|
|
956
|
+
this.ctx.closePath();
|
|
957
|
+
this.ctx.restore();
|
|
958
|
+
};
|
|
959
|
+
/**
|
|
960
|
+
* Draw a polygon.
|
|
961
|
+
*
|
|
962
|
+
* @method polygon
|
|
963
|
+
* @param {Polygon} polygon - The polygon to draw.
|
|
964
|
+
* @param {string} color - The CSS color to draw the polygon with.
|
|
965
|
+
* @param {string} lineWidth - The line width to use.
|
|
966
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
967
|
+
*
|
|
968
|
+
* @return {void}
|
|
969
|
+
* @instance
|
|
970
|
+
* @memberof drawutils
|
|
971
|
+
*/
|
|
972
|
+
drawutils.prototype.polygon = function (polygon, color, lineWidth, strokeOptions) {
|
|
973
|
+
this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
|
|
974
|
+
};
|
|
975
|
+
/**
|
|
976
|
+
* Draw a polygon line (alternative function to the polygon).
|
|
977
|
+
*
|
|
978
|
+
* @method polyline
|
|
979
|
+
* @param {XYCoords[]} vertices - The polygon vertices to draw.
|
|
980
|
+
* @param {boolan} isOpen - If true the polyline will not be closed at its end.
|
|
981
|
+
* @param {string} color - The CSS color to draw the polygon with.
|
|
982
|
+
* @param {number} lineWidth - The line width (default is 1.0);
|
|
983
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
984
|
+
*
|
|
985
|
+
* @return {void}
|
|
986
|
+
* @instance
|
|
987
|
+
* @memberof drawutils
|
|
988
|
+
*/
|
|
989
|
+
drawutils.prototype.polyline = function (vertices, isOpen, color, lineWidth, strokeOptions) {
|
|
990
|
+
if (vertices.length <= 1) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
this.ctx.save();
|
|
994
|
+
this.applyStrokeOpts(strokeOptions);
|
|
995
|
+
this.ctx.beginPath();
|
|
996
|
+
this.ctx.lineWidth = lineWidth || 1.0;
|
|
997
|
+
this.ctx.moveTo(this.offset.x + vertices[0].x * this.scale.x, this.offset.y + vertices[0].y * this.scale.y);
|
|
998
|
+
for (var i = 0; i < vertices.length; i++) {
|
|
999
|
+
this.ctx.lineTo(this.offset.x + vertices[i].x * this.scale.x, this.offset.y + vertices[i].y * this.scale.y);
|
|
1000
|
+
}
|
|
1001
|
+
if (!isOpen)
|
|
1002
|
+
// && vertices.length > 2 )
|
|
1003
|
+
this.ctx.closePath();
|
|
1004
|
+
this._fillOrDraw(color);
|
|
1005
|
+
this.ctx.closePath();
|
|
1006
|
+
this.ctx.setLineDash([]);
|
|
1007
|
+
this.ctx.restore();
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Draw a text at the given relative position.
|
|
1011
|
+
*
|
|
1012
|
+
* @method text
|
|
1013
|
+
* @param {string} text - The text to draw.
|
|
1014
|
+
* @param {number} x - The x-position to draw the text at.
|
|
1015
|
+
* @param {number} y - The y-position to draw the text at.
|
|
1016
|
+
* @param {string=} options.color - The Color to use.
|
|
1017
|
+
* @param {string=} options.fontFamily - The font family to use.
|
|
1018
|
+
* @param {number=} options.fontSize - The font size (in pixels) to use.
|
|
1019
|
+
* @param {FontStyle=} options.fontStyle - The font style to use.
|
|
1020
|
+
* @param {FontWeight=} options.fontWeight - The font weight to use.
|
|
1021
|
+
* @param {number=} options.lineHeight - The line height (in pixels) to use.
|
|
1022
|
+
* @param {number=} options.rotation - The (optional) rotation in radians.
|
|
1023
|
+
* @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `"left" || "right" || "center" || "start" || "end"`.
|
|
1024
|
+
* @return {void}
|
|
1025
|
+
* @instance
|
|
1026
|
+
* @memberof drawutils
|
|
1027
|
+
*/
|
|
1028
|
+
drawutils.prototype.text = function (text, x, y, options) {
|
|
1029
|
+
// See https://stackoverflow.com/a/23523697
|
|
1030
|
+
var _a, _b, _c;
|
|
1031
|
+
options = options || {};
|
|
1032
|
+
this.ctx.save();
|
|
1033
|
+
var relX = this.offset.x + x * this.scale.x;
|
|
1034
|
+
var relY = this.offset.y + y * this.scale.y;
|
|
1035
|
+
var color = options.color || "black";
|
|
1036
|
+
if (options.fontSize || options.fontFamily) {
|
|
1037
|
+
// Scaling of text only works in uniform mode
|
|
1038
|
+
this.ctx.font =
|
|
1039
|
+
(options.fontWeight ? options.fontWeight + " " : "") +
|
|
1040
|
+
(options.fontStyle ? options.fontStyle + " " : "") +
|
|
1041
|
+
(options.fontSize ? options.fontSize * this.scale.x + "px " : " ") +
|
|
1042
|
+
(options.fontFamily
|
|
1043
|
+
? options.fontFamily.indexOf(" ") === -1
|
|
1044
|
+
? options.fontFamily
|
|
1045
|
+
: "\"".concat(options.fontFamily, "\"")
|
|
1046
|
+
: "Arial");
|
|
1047
|
+
}
|
|
1048
|
+
if (options.textAlign) {
|
|
1049
|
+
this.ctx.textAlign = options.textAlign;
|
|
1050
|
+
}
|
|
1051
|
+
var rotation = (_a = options.rotation) !== null && _a !== void 0 ? _a : 0.0;
|
|
1052
|
+
var lineHeight = ((_c = (_b = options.lineHeight) !== null && _b !== void 0 ? _b : options.fontSize) !== null && _c !== void 0 ? _c : 0) * this.scale.x;
|
|
1053
|
+
this.ctx.translate(relX, relY);
|
|
1054
|
+
this.ctx.rotate(rotation);
|
|
1055
|
+
if (this.fillShapes) {
|
|
1056
|
+
this.ctx.fillStyle = color;
|
|
1057
|
+
this.ctx.fillText(text, 0, lineHeight / 2);
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
this.ctx.strokeStyle = color;
|
|
1061
|
+
this.ctx.strokeText(text, 0, lineHeight / 2);
|
|
1062
|
+
}
|
|
1063
|
+
// this.ctx.translate(-relX, -relY);
|
|
1064
|
+
// this.ctx.rotate(-rotation); // is this necessary before 'restore()'?
|
|
1065
|
+
this.ctx.restore();
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Draw a non-scaling text label at the given position.
|
|
1069
|
+
*
|
|
1070
|
+
* Note that these are absolute label positions, they are not affected by offset or scale.
|
|
1071
|
+
*
|
|
1072
|
+
* @method label
|
|
1073
|
+
* @param {string} text - The text to draw.
|
|
1074
|
+
* @param {number} x - The x-position to draw the text at.
|
|
1075
|
+
* @param {number} y - The y-position to draw the text at.
|
|
1076
|
+
* @param {number=} rotation - The (optional) rotation in radians (default=0).
|
|
1077
|
+
* @param {string=} color - The color to render the text with (default=black).
|
|
1078
|
+
* @return {void}
|
|
1079
|
+
* @instance
|
|
1080
|
+
* @memberof drawutils
|
|
1081
|
+
*/
|
|
1082
|
+
drawutils.prototype.label = function (text, x, y, rotation, color) {
|
|
1083
|
+
this.ctx.save();
|
|
1084
|
+
this.ctx.font = "lighter 9pt Arial";
|
|
1085
|
+
this.ctx.translate(x, y);
|
|
1086
|
+
if (typeof rotation !== "undefined")
|
|
1087
|
+
this.ctx.rotate(rotation);
|
|
1088
|
+
this.ctx.fillStyle = color || "black";
|
|
1089
|
+
if (this.fillShapes) {
|
|
1090
|
+
this.ctx.fillText(text, 0, 0);
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
this.ctx.strokeText(text, 0, 0);
|
|
1094
|
+
}
|
|
1095
|
+
this.ctx.restore();
|
|
1096
|
+
};
|
|
1097
|
+
/**
|
|
1098
|
+
* Draw an SVG-like path given by the specified path data.
|
|
1099
|
+
*
|
|
1100
|
+
*
|
|
1101
|
+
* @method path
|
|
1102
|
+
* @param {SVGPathData} pathData - An array of path commands and params.
|
|
1103
|
+
* @param {string=null} color - (optional) The color to draw this path with (default is null).
|
|
1104
|
+
* @param {number=1} lineWidth - (optional) the line width to use (default is 1).
|
|
1105
|
+
* @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.
|
|
1106
|
+
* @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
|
|
1107
|
+
* @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
|
|
1108
|
+
* @instance
|
|
1109
|
+
* @memberof drawutils
|
|
1110
|
+
* @return {R} An instance representing the drawn path.
|
|
1111
|
+
*/
|
|
1112
|
+
drawutils.prototype.path = function (pathData, color, lineWidth, options) {
|
|
1113
|
+
var d = options && options.inplace ? pathData : drawutilssvg_1.drawutilssvg.copyPathData(pathData);
|
|
1114
|
+
drawutilssvg_1.drawutilssvg.transformPathData(d, this.offset, this.scale);
|
|
1115
|
+
if (color) {
|
|
1116
|
+
this.ctx.strokeStyle = color;
|
|
1117
|
+
}
|
|
1118
|
+
this.ctx.lineWidth = lineWidth || 1;
|
|
1119
|
+
this.applyStrokeOpts(options);
|
|
1120
|
+
if (this.fillShapes) {
|
|
1121
|
+
if (color) {
|
|
1122
|
+
this.ctx.fillStyle = color;
|
|
1123
|
+
}
|
|
1124
|
+
this.ctx.fill(new Path2D(d.join(" ")));
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
if (color) {
|
|
1128
|
+
this.ctx.strokeStyle = color;
|
|
1129
|
+
}
|
|
1130
|
+
this.ctx.stroke(new Path2D(d.join(" ")));
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
/**
|
|
1134
|
+
* Due to gl compatibility there is a generic 'clear' function required
|
|
1135
|
+
* to avoid accessing the context object itself directly.
|
|
1136
|
+
*
|
|
1137
|
+
* This function just fills the whole canvas with a single color.
|
|
1138
|
+
*
|
|
1139
|
+
* @param {string} color - The color to clear with.
|
|
1140
|
+
**/
|
|
1141
|
+
drawutils.prototype.clear = function (color) {
|
|
1142
|
+
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
|
1143
|
+
this.ctx.fillStyle = color;
|
|
1144
|
+
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
|
1145
|
+
};
|
|
1146
|
+
drawutils.helpers = {
|
|
1147
|
+
// A helper function to define the clipping path.
|
|
1148
|
+
// This could be a candidate for the draw library.
|
|
1149
|
+
clipPoly: function (ctx, offset, scale, vertices) {
|
|
1150
|
+
ctx.beginPath();
|
|
1151
|
+
// Set clip mask
|
|
1152
|
+
ctx.moveTo(offset.x + vertices[0].x * scale.x, offset.y + vertices[0].y * scale.y);
|
|
1153
|
+
for (var i = 1; i < vertices.length; i++) {
|
|
1154
|
+
var vert = vertices[i];
|
|
1155
|
+
ctx.lineTo(offset.x + vert.x * scale.x, offset.y + vert.y * scale.y);
|
|
1156
|
+
}
|
|
1157
|
+
ctx.closePath();
|
|
1158
|
+
ctx.clip();
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
return drawutils;
|
|
1162
|
+
}());
|
|
1163
|
+
exports.drawutils = drawutils;
|
|
1164
|
+
//# sourceMappingURL=draw.js.map
|