plotboilerplate 1.28.0 → 1.29.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/README.md +8 -0
- package/dist/index.esm.js +335 -39
- 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 +335 -37
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Circle.d.ts +70 -3
- package/src/cjs/Circle.js +159 -4
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/Triangle.d.ts +40 -4
- package/src/cjs/Triangle.js +127 -31
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/VertTuple.d.ts +4 -1
- package/src/cjs/VertTuple.js +6 -1
- package/src/cjs/VertTuple.js.map +1 -1
- package/src/cjs/Vertex.d.ts +25 -2
- package/src/cjs/Vertex.js +43 -1
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/utils/algorithms/minimalContainingCircleFromPoints.d.ts +21 -0
- package/src/cjs/utils/algorithms/minimalContainingCircleFromPoints.js +73 -0
- package/src/cjs/utils/algorithms/minimalContainingCircleFromPoints.js.map +1 -0
- package/src/cjs/utils/algorithms/minimalEnclosingCircleFromPoints.d.ts +21 -0
- package/src/cjs/utils/algorithms/minimalEnclosingCircleFromPoints.js +73 -0
- package/src/cjs/utils/algorithms/minimalEnclosingCircleFromPoints.js.map +1 -0
- package/src/cjs/utils/algorithms/pointsMinimalContainingCircle.d.ts +21 -0
- package/src/cjs/utils/algorithms/pointsMinimalContainingCircle.js +73 -0
- package/src/cjs/utils/algorithms/pointsMinimalContainingCircle.js.map +1 -0
- package/src/cjs/utils/algorithms/solveApollonius3.d.ts +69 -0
- package/src/cjs/utils/algorithms/solveApollonius3.js +118 -0
- package/src/cjs/utils/algorithms/solveApollonius3.js.map +1 -0
- package/src/esm/Circle.d.ts +70 -3
- package/src/esm/Circle.js +159 -4
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/Triangle.d.ts +40 -4
- package/src/esm/Triangle.js +128 -32
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/VertTuple.d.ts +4 -1
- package/src/esm/VertTuple.js +6 -1
- package/src/esm/VertTuple.js.map +1 -1
- package/src/esm/Vertex.d.ts +25 -2
- package/src/esm/Vertex.js +44 -2
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/utils/algorithms/minimalContainingCircleFromPoints.d.ts +21 -0
- package/src/esm/utils/algorithms/minimalContainingCircleFromPoints.js +69 -0
- package/src/esm/utils/algorithms/minimalContainingCircleFromPoints.js.map +1 -0
- package/src/esm/utils/algorithms/minimalEnclosingCircleFromPoints.d.ts +21 -0
- package/src/esm/utils/algorithms/minimalEnclosingCircleFromPoints.js +69 -0
- package/src/esm/utils/algorithms/minimalEnclosingCircleFromPoints.js.map +1 -0
- package/src/esm/utils/algorithms/pointsMinimalContainingCircle.d.ts +21 -0
- package/src/esm/utils/algorithms/pointsMinimalContainingCircle.js +69 -0
- package/src/esm/utils/algorithms/pointsMinimalContainingCircle.js.map +1 -0
- package/src/esm/utils/algorithms/solveApollonius3.d.ts +69 -0
- package/src/esm/utils/algorithms/solveApollonius3.js +114 -0
- package/src/esm/utils/algorithms/solveApollonius3.js.map +1 -0
- package/src/index-gl.js +5 -2
- package/src/index.js +25 -17
- package/src/ts/Circle.ts +178 -5
- package/src/ts/Triangle.ts +148 -41
- package/src/ts/VertTuple.ts +14 -1
- package/src/ts/Vertex.ts +44 -2
- package/src/ts/utils/algorithms/minimalEnclosingCircleFromPoints.ts +69 -0
- package/src/ts/utils/algorithms/solveApollonius3.ts +132 -0
- package/src/_cjs/BezierPath.d.ts +0 -610
- package/src/_cjs/BezierPath.js +0 -1127
- package/src/_cjs/BezierPath.js.map +0 -1
- package/src/_cjs/Bounds.d.ts +0 -252
- package/src/_cjs/Bounds.js +0 -320
- package/src/_cjs/Bounds.js.map +0 -1
- package/src/_cjs/Circle.d.ts +0 -214
- package/src/_cjs/Circle.js +0 -339
- package/src/_cjs/Circle.js.map +0 -1
- package/src/_cjs/CircleSector.d.ts +0 -211
- package/src/_cjs/CircleSector.js +0 -364
- package/src/_cjs/CircleSector.js.map +0 -1
- package/src/_cjs/CubicBezierCurve.d.ts +0 -656
- package/src/_cjs/CubicBezierCurve.js +0 -1062
- package/src/_cjs/CubicBezierCurve.js.map +0 -1
- package/src/_cjs/Grid.d.ts +0 -83
- package/src/_cjs/Grid.js +0 -90
- package/src/_cjs/Grid.js.map +0 -1
- package/src/_cjs/KeyHandler.d.ts +0 -177
- package/src/_cjs/KeyHandler.js +0 -435
- package/src/_cjs/KeyHandler.js.map +0 -1
- package/src/_cjs/Line.d.ts +0 -134
- package/src/_cjs/Line.js +0 -220
- package/src/_cjs/Line.js.map +0 -1
- package/src/_cjs/MouseHandler.d.ts +0 -283
- package/src/_cjs/MouseHandler.js +0 -423
- package/src/_cjs/MouseHandler.js.map +0 -1
- package/src/_cjs/PBImage.d.ts +0 -81
- package/src/_cjs/PBImage.js +0 -61
- package/src/_cjs/PBImage.js.map +0 -1
- package/src/_cjs/PBText.d.ts +0 -118
- package/src/_cjs/PBText.js +0 -63
- package/src/_cjs/PBText.js.map +0 -1
- package/src/_cjs/PlotBoilerplate.d.ts +0 -899
- package/src/_cjs/PlotBoilerplate.js +0 -2348
- package/src/_cjs/PlotBoilerplate.js.map +0 -1
- package/src/_cjs/Polygon.d.ts +0 -520
- package/src/_cjs/Polygon.js +0 -933
- package/src/_cjs/Polygon.js.map +0 -1
- package/src/_cjs/SVGBuilder.d.ts +0 -47
- package/src/_cjs/SVGBuilder.js +0 -100
- package/src/_cjs/SVGBuilder.js.map +0 -1
- package/src/_cjs/Triangle.d.ts +0 -392
- package/src/_cjs/Triangle.js +0 -497
- package/src/_cjs/Triangle.js.map +0 -1
- package/src/_cjs/UIDGenerator.d.ts +0 -12
- package/src/_cjs/UIDGenerator.js +0 -21
- package/src/_cjs/UIDGenerator.js.map +0 -1
- package/src/_cjs/VEllipse.d.ts +0 -319
- package/src/_cjs/VEllipse.js +0 -578
- package/src/_cjs/VEllipse.js.map +0 -1
- package/src/_cjs/VEllipseSector.d.ts +0 -230
- package/src/_cjs/VEllipseSector.js +0 -428
- package/src/_cjs/VEllipseSector.js.map +0 -1
- package/src/_cjs/Vector.d.ts +0 -126
- package/src/_cjs/Vector.js +0 -199
- package/src/_cjs/Vector.js.map +0 -1
- package/src/_cjs/VertTuple.d.ts +0 -284
- package/src/_cjs/VertTuple.js +0 -348
- package/src/_cjs/VertTuple.js.map +0 -1
- package/src/_cjs/Vertex.d.ts +0 -498
- package/src/_cjs/Vertex.js +0 -703
- package/src/_cjs/Vertex.js.map +0 -1
- package/src/_cjs/VertexAttr.d.ts +0 -72
- package/src/_cjs/VertexAttr.js +0 -59
- package/src/_cjs/VertexAttr.js.map +0 -1
- package/src/_cjs/VertexListeners.d.ts +0 -208
- package/src/_cjs/VertexListeners.js +0 -267
- package/src/_cjs/VertexListeners.js.map +0 -1
- package/src/_cjs/draw.d.ts +0 -657
- package/src/_cjs/draw.js +0 -1164
- package/src/_cjs/draw.js.map +0 -1
- package/src/_cjs/drawgl.d.ts +0 -544
- package/src/_cjs/drawgl.js +0 -794
- package/src/_cjs/drawgl.js.map +0 -1
- package/src/_cjs/drawutilssvg.d.ts +0 -954
- package/src/_cjs/drawutilssvg.js +0 -1713
- package/src/_cjs/drawutilssvg.js.map +0 -1
- package/src/_cjs/entry-glsupport.js +0 -28
- package/src/_cjs/entry.js +0 -29
- package/src/_cjs/geomutils.d.ts +0 -77
- package/src/_cjs/geomutils.js +0 -126
- package/src/_cjs/geomutils.js.map +0 -1
- package/src/_cjs/index.d.ts +0 -102
- package/src/_cjs/index.js +0 -128
- package/src/_cjs/index.js.map +0 -1
- package/src/_cjs/interfaces/DrawLib.d.ts +0 -582
- package/src/_cjs/interfaces/DrawLib.js +0 -32
- package/src/_cjs/interfaces/DrawLib.js.map +0 -1
- package/src/_cjs/interfaces/additionals.d.ts +0 -95
- package/src/_cjs/interfaces/additionals.js +0 -3
- package/src/_cjs/interfaces/additionals.js.map +0 -1
- package/src/_cjs/interfaces/core.d.ts +0 -286
- package/src/_cjs/interfaces/core.js +0 -30
- package/src/_cjs/interfaces/core.js.map +0 -1
- package/src/_cjs/interfaces/externals.d.ts +0 -56
- package/src/_cjs/interfaces/externals.js +0 -8
- package/src/_cjs/interfaces/externals.js.map +0 -1
- package/src/_cjs/interfaces/index.d.ts +0 -4
- package/src/_cjs/interfaces/index.js +0 -21
- package/src/_cjs/interfaces/index.js.map +0 -1
- package/src/_cjs/module.d.ts +0 -26
- package/src/_cjs/module.js +0 -60
- package/src/_cjs/module.js.map +0 -1
- package/src/_cjs/utils/InitializationObserver.d.ts +0 -18
- package/src/_cjs/utils/InitializationObserver.js +0 -63
- package/src/_cjs/utils/InitializationObserver.js.map +0 -1
- package/src/_cjs/utils/LissajousFigure.d.ts +0 -34
- package/src/_cjs/utils/LissajousFigure.js +0 -100
- package/src/_cjs/utils/LissajousFigure.js.map +0 -1
- package/src/_cjs/utils/NGons.d.ts +0 -13
- package/src/_cjs/utils/NGons.js +0 -36
- package/src/_cjs/utils/NGons.js.map +0 -1
- package/src/_cjs/utils/Params.d.ts +0 -17
- package/src/_cjs/utils/Params.js +0 -53
- package/src/_cjs/utils/Params.js.map +0 -1
- package/src/_cjs/utils/PerlinNoise.d.ts +0 -19
- package/src/_cjs/utils/PerlinNoise.js +0 -352
- package/src/_cjs/utils/PerlinNoise.js.map +0 -1
- package/src/_cjs/utils/SVGPathUtils.d.ts +0 -22
- package/src/_cjs/utils/SVGPathUtils.js +0 -45
- package/src/_cjs/utils/SVGPathUtils.js.map +0 -1
- package/src/_cjs/utils/WebColors.d.ts +0 -35
- package/src/_cjs/utils/WebColors.js +0 -58
- package/src/_cjs/utils/WebColors.js.map +0 -1
- package/src/_cjs/utils/WebColorsContrast.d.ts +0 -6
- package/src/_cjs/utils/WebColorsContrast.js +0 -12
- package/src/_cjs/utils/WebColorsContrast.js.map +0 -1
- package/src/_cjs/utils/WebColorsMalachite.d.ts +0 -12
- package/src/_cjs/utils/WebColorsMalachite.js +0 -28
- package/src/_cjs/utils/WebColorsMalachite.js.map +0 -1
- package/src/_cjs/utils/_gup.js_ +0 -13
- package/src/_cjs/utils/algorithms/CatmullRomPath.d.ts +0 -60
- package/src/_cjs/utils/algorithms/CatmullRomPath.js +0 -108
- package/src/_cjs/utils/algorithms/CatmullRomPath.js.map +0 -1
- package/src/_cjs/utils/algorithms/CircleIntersections.d.ts +0 -170
- package/src/_cjs/utils/algorithms/CircleIntersections.js +0 -310
- package/src/_cjs/utils/algorithms/CircleIntersections.js.map +0 -1
- package/src/_cjs/utils/algorithms/ContourLineDetection.d.ts +0 -150
- package/src/_cjs/utils/algorithms/ContourLineDetection.js +0 -367
- package/src/_cjs/utils/algorithms/ContourLineDetection.js.map +0 -1
- package/src/_cjs/utils/algorithms/CubicSplinePath.d.ts +0 -63
- package/src/_cjs/utils/algorithms/CubicSplinePath.js +0 -175
- package/src/_cjs/utils/algorithms/CubicSplinePath.js.map +0 -1
- package/src/_cjs/utils/algorithms/HobbyPath.d.ts +0 -81
- package/src/_cjs/utils/algorithms/HobbyPath.js +0 -278
- package/src/_cjs/utils/algorithms/HobbyPath.js.map +0 -1
- package/src/_cjs/utils/algorithms/Metaballs.d.ts +0 -30
- package/src/_cjs/utils/algorithms/Metaballs.js +0 -114
- package/src/_cjs/utils/algorithms/Metaballs.js.map +0 -1
- package/src/_cjs/utils/algorithms/PolygonInset.d.ts +0 -184
- package/src/_cjs/utils/algorithms/PolygonInset.js +0 -431
- package/src/_cjs/utils/algorithms/PolygonInset.js.map +0 -1
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js +0 -269
- package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
- package/src/_cjs/utils/algorithms/arrayFill.d.ts +0 -8
- package/src/_cjs/utils/algorithms/arrayFill.js +0 -18
- package/src/_cjs/utils/algorithms/arrayFill.js.map +0 -1
- package/src/_cjs/utils/algorithms/arrayResize.d.ts +0 -8
- package/src/_cjs/utils/algorithms/arrayResize.js +0 -24
- package/src/_cjs/utils/algorithms/arrayResize.js.map +0 -1
- package/src/_cjs/utils/algorithms/arrayShuffle.d.ts +0 -8
- package/src/_cjs/utils/algorithms/arrayShuffle.js +0 -15
- package/src/_cjs/utils/algorithms/arrayShuffle.js.map +0 -1
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.js +0 -51
- package/src/_cjs/utils/algorithms/clearDuplicateVertices.js.map +0 -1
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js +0 -61
- package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
- package/src/_cjs/utils/algorithms/convexHull.d.ts +0 -23
- package/src/_cjs/utils/algorithms/convexHull.js +0 -71
- package/src/_cjs/utils/algorithms/convexHull.js.map +0 -1
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.js +0 -145
- package/src/_cjs/utils/algorithms/convexPolygonIncircle.js.map +0 -1
- package/src/_cjs/utils/algorithms/delaunay.d.ts +0 -30
- package/src/_cjs/utils/algorithms/delaunay.js +0 -158
- package/src/_cjs/utils/algorithms/delaunay.js.map +0 -1
- package/src/_cjs/utils/algorithms/delaunay2voronoi.d.ts +0 -25
- package/src/_cjs/utils/algorithms/delaunay2voronoi.js +0 -104
- package/src/_cjs/utils/algorithms/delaunay2voronoi.js.map +0 -1
- package/src/_cjs/utils/algorithms/detectPaths.d.ts +0 -21
- package/src/_cjs/utils/algorithms/detectPaths.js +0 -169
- package/src/_cjs/utils/algorithms/detectPaths.js.map +0 -1
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js +0 -51
- package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
- package/src/_cjs/utils/algorithms/getContrastColor.d.ts +0 -13
- package/src/_cjs/utils/algorithms/getContrastColor.js +0 -26
- package/src/_cjs/utils/algorithms/getContrastColor.js.map +0 -1
- package/src/_cjs/utils/algorithms/matrixFill.d.ts +0 -10
- package/src/_cjs/utils/algorithms/matrixFill.js +0 -21
- package/src/_cjs/utils/algorithms/matrixFill.js.map +0 -1
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js +0 -270
- package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js +0 -102
- package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
- package/src/_cjs/utils/algorithms/sutherlandHodgman.d.ts +0 -16
- package/src/_cjs/utils/algorithms/sutherlandHodgman.js +0 -76
- package/src/_cjs/utils/algorithms/sutherlandHodgman.js.map +0 -1
- package/src/_cjs/utils/cloneVertexArray.d.ts +0 -13
- package/src/_cjs/utils/cloneVertexArray.js +0 -23
- package/src/_cjs/utils/cloneVertexArray.js.map +0 -1
- package/src/_cjs/utils/createRandomizedPolygon.d.ts +0 -14
- package/src/_cjs/utils/createRandomizedPolygon.js +0 -32
- package/src/_cjs/utils/createRandomizedPolygon.js.map +0 -1
- package/src/_cjs/utils/creategui.js +0 -434
- package/src/_cjs/utils/dat.gui.arrowbounce.polyfill.js +0 -128
- package/src/_cjs/utils/dat.gui.title.polyfill.js +0 -35
- package/src/_cjs/utils/datastructures/CircularIntervalSet.d.ts +0 -83
- package/src/_cjs/utils/datastructures/CircularIntervalSet.js +0 -163
- package/src/_cjs/utils/datastructures/CircularIntervalSet.js.map +0 -1
- package/src/_cjs/utils/datastructures/Color.d.ts +0 -391
- package/src/_cjs/utils/datastructures/Color.js +0 -1084
- package/src/_cjs/utils/datastructures/Color.js.map +0 -1
- package/src/_cjs/utils/datastructures/ColorGradient.d.ts +0 -81
- package/src/_cjs/utils/datastructures/ColorGradient.js +0 -176
- package/src/_cjs/utils/datastructures/ColorGradient.js.map +0 -1
- package/src/_cjs/utils/datastructures/DataGrid2d.d.ts +0 -53
- package/src/_cjs/utils/datastructures/DataGrid2d.js +0 -20
- package/src/_cjs/utils/datastructures/DataGrid2d.js.map +0 -1
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js +0 -155
- package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js +0 -84
- package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
- package/src/_cjs/utils/datastructures/GenericPath.d.ts +0 -86
- package/src/_cjs/utils/datastructures/GenericPath.js +0 -122
- package/src/_cjs/utils/datastructures/GenericPath.js.map +0 -1
- package/src/_cjs/utils/datastructures/GeometryMesh.d.ts +0 -49
- package/src/_cjs/utils/datastructures/GeometryMesh.js +0 -58
- package/src/_cjs/utils/datastructures/GeometryMesh.js.map +0 -1
- package/src/_cjs/utils/datastructures/Girih.d.ts +0 -181
- package/src/_cjs/utils/datastructures/Girih.js +0 -266
- package/src/_cjs/utils/datastructures/Girih.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihBowtie.d.ts +0 -37
- package/src/_cjs/utils/datastructures/GirihBowtie.js +0 -152
- package/src/_cjs/utils/datastructures/GirihBowtie.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihDecagon.d.ts +0 -52
- package/src/_cjs/utils/datastructures/GirihDecagon.js +0 -132
- package/src/_cjs/utils/datastructures/GirihDecagon.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihHexagon.d.ts +0 -39
- package/src/_cjs/utils/datastructures/GirihHexagon.js +0 -200
- package/src/_cjs/utils/datastructures/GirihHexagon.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js +0 -189
- package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihPentagon.d.ts +0 -37
- package/src/_cjs/utils/datastructures/GirihPentagon.js +0 -109
- package/src/_cjs/utils/datastructures/GirihPentagon.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihRhombus.d.ts +0 -38
- package/src/_cjs/utils/datastructures/GirihRhombus.js +0 -155
- package/src/_cjs/utils/datastructures/GirihRhombus.js.map +0 -1
- package/src/_cjs/utils/datastructures/GirihTile.d.ts +0 -283
- package/src/_cjs/utils/datastructures/GirihTile.js +0 -308
- package/src/_cjs/utils/datastructures/GirihTile.js.map +0 -1
- package/src/_cjs/utils/datastructures/Matrix4x4.d.ts +0 -244
- package/src/_cjs/utils/datastructures/Matrix4x4.js +0 -262
- package/src/_cjs/utils/datastructures/Matrix4x4.js.map +0 -1
- package/src/_cjs/utils/datastructures/VoronoiCell.d.ts +0 -122
- package/src/_cjs/utils/datastructures/VoronoiCell.js +0 -183
- package/src/_cjs/utils/datastructures/VoronoiCell.js.map +0 -1
- package/src/_cjs/utils/datastructures/interfaces.d.ts +0 -13
- package/src/_cjs/utils/datastructures/interfaces.js +0 -10
- package/src/_cjs/utils/datastructures/interfaces.js.map +0 -1
- package/src/_cjs/utils/detectDarkMode.d.ts +0 -10
- package/src/_cjs/utils/detectDarkMode.js +0 -41
- package/src/_cjs/utils/detectDarkMode.js.map +0 -1
- package/src/_cjs/utils/dom/components/ColorGradientPicker.d.ts +0 -246
- package/src/_cjs/utils/dom/components/ColorGradientPicker.js +0 -667
- package/src/_cjs/utils/dom/components/ColorGradientPicker.js.map +0 -1
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +0 -129
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js +0 -520
- package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js.map +0 -1
- package/src/_cjs/utils/dom/components/ColorGradientSelector.d.ts +0 -118
- package/src/_cjs/utils/dom/components/ColorGradientSelector.js +0 -327
- package/src/_cjs/utils/dom/components/ColorGradientSelector.js.map +0 -1
- package/src/_cjs/utils/dom/components/Test.d.ts +0 -7
- package/src/_cjs/utils/dom/components/Test.js +0 -30
- package/src/_cjs/utils/dom/components/Test.js.map +0 -1
- package/src/_cjs/utils/dom/getAvailableContainerSpace.d.ts +0 -2
- package/src/_cjs/utils/dom/getAvailableContainerSpace.js +0 -29
- package/src/_cjs/utils/dom/getAvailableContainerSpace.js.map +0 -1
- package/src/_cjs/utils/dom/getFProp.d.ts +0 -5
- package/src/_cjs/utils/dom/getFProp.js +0 -12
- package/src/_cjs/utils/dom/getFProp.js.map +0 -1
- package/src/_cjs/utils/dom/guiSizeToggler.d.ts +0 -18
- package/src/_cjs/utils/dom/guiSizeToggler.js +0 -44
- package/src/_cjs/utils/dom/guiSizeToggler.js.map +0 -1
- package/src/_cjs/utils/findInVertexArray.d.ts +0 -19
- package/src/_cjs/utils/findInVertexArray.js +0 -29
- package/src/_cjs/utils/findInVertexArray.js.map +0 -1
- package/src/_cjs/utils/getFProp.d.ts +0 -5
- package/src/_cjs/utils/getFProp.js +0 -12
- package/src/_cjs/utils/getFProp.js.map +0 -1
- package/src/_cjs/utils/gup.d.ts +0 -14
- package/src/_cjs/utils/gup.js +0 -31
- package/src/_cjs/utils/gup.js.map +0 -1
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js +0 -655
- package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
- package/src/_cjs/utils/helpers/CircleHelper.d.ts +0 -73
- package/src/_cjs/utils/helpers/CircleHelper.js +0 -93
- package/src/_cjs/utils/helpers/CircleHelper.js.map +0 -1
- package/src/_cjs/utils/helpers/CircleSectorHelper.d.ts +0 -90
- package/src/_cjs/utils/helpers/CircleSectorHelper.js +0 -114
- package/src/_cjs/utils/helpers/CircleSectorHelper.js.map +0 -1
- package/src/_cjs/utils/helpers/TriangleHelper.d.ts +0 -57
- package/src/_cjs/utils/helpers/TriangleHelper.js +0 -83
- package/src/_cjs/utils/helpers/TriangleHelper.js.map +0 -1
- package/src/_cjs/utils/helpers/VEllipseHelper.d.ts +0 -32
- package/src/_cjs/utils/helpers/VEllipseHelper.js +0 -88
- package/src/_cjs/utils/helpers/VEllipseHelper.js.map +0 -1
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.js +0 -135
- package/src/_cjs/utils/helpers/VEllipseSectorHelper.js.map +0 -1
- package/src/_cjs/utils/io/DndFileHandler.d.ts +0 -63
- package/src/_cjs/utils/io/DndFileHandler.js +0 -112
- package/src/_cjs/utils/io/DndFileHandler.js.map +0 -1
- package/src/_cjs/utils/io/FileDrop.d.ts +0 -110
- package/src/_cjs/utils/io/FileDrop.js +0 -177
- package/src/_cjs/utils/io/FileDrop.js.map +0 -1
- package/src/_cjs/utils/lil.gui.arrowbounce.polyfill.js +0 -133
- package/src/_cjs/utils/lil.gui.title.polyfill.js +0 -32
- package/src/_cjs/utils/module.js +0 -18
- package/src/_cjs/utils/parsers/LinearColorGradientParser.d.ts +0 -78
- package/src/_cjs/utils/parsers/LinearColorGradientParser.js +0 -224
- package/src/_cjs/utils/parsers/LinearColorGradientParser.js.map +0 -1
- package/src/_cjs/utils/parsers/OBJParser.d.ts +0 -24
- package/src/_cjs/utils/parsers/OBJParser.js +0 -77
- package/src/_cjs/utils/parsers/OBJParser.js.map +0 -1
- package/src/_cjs/utils/parsers/STLParser.d.ts +0 -61
- package/src/_cjs/utils/parsers/STLParser.js +0 -182
- package/src/_cjs/utils/parsers/STLParser.js.map +0 -1
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.js +0 -486
- package/src/_cjs/utils/parsers/svg/parseSVGPathData.js.map +0 -1
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.js +0 -53
- package/src/_cjs/utils/parsers/svg/splitSVGPathData.js.map +0 -1
- package/src/_cjs/utils/parsers/svg/types.d.ts +0 -63
- package/src/_cjs/utils/parsers/svg/types.js +0 -17
- package/src/_cjs/utils/parsers/svg/types.js.map +0 -1
- package/src/_cjs/utils/ts-runner.js +0 -146
- package/src/_cjs/utils/tsAsyncScriptLoader.js +0 -74
- package/src/_esm/BezierPath.d.ts +0 -610
- package/src/_esm/BezierPath.js +0 -1124
- package/src/_esm/BezierPath.js.map +0 -1
- package/src/_esm/Bounds.d.ts +0 -252
- package/src/_esm/Bounds.js +0 -317
- package/src/_esm/Bounds.js.map +0 -1
- package/src/_esm/Circle.d.ts +0 -214
- package/src/_esm/Circle.js +0 -335
- package/src/_esm/Circle.js.map +0 -1
- package/src/_esm/CircleSector.d.ts +0 -211
- package/src/_esm/CircleSector.js +0 -359
- package/src/_esm/CircleSector.js.map +0 -1
- package/src/_esm/CubicBezierCurve.d.ts +0 -656
- package/src/_esm/CubicBezierCurve.js +0 -1057
- package/src/_esm/CubicBezierCurve.js.map +0 -1
- package/src/_esm/Grid.d.ts +0 -83
- package/src/_esm/Grid.js +0 -89
- package/src/_esm/Grid.js.map +0 -1
- package/src/_esm/KeyHandler.d.ts +0 -177
- package/src/_esm/KeyHandler.js +0 -434
- package/src/_esm/KeyHandler.js.map +0 -1
- package/src/_esm/Line.d.ts +0 -134
- package/src/_esm/Line.js +0 -200
- package/src/_esm/Line.js.map +0 -1
- package/src/_esm/MouseHandler.d.ts +0 -283
- package/src/_esm/MouseHandler.js +0 -397
- package/src/_esm/MouseHandler.js.map +0 -1
- package/src/_esm/PBImage.d.ts +0 -81
- package/src/_esm/PBImage.js +0 -60
- package/src/_esm/PBImage.js.map +0 -1
- package/src/_esm/PBText.d.ts +0 -118
- package/src/_esm/PBText.js +0 -62
- package/src/_esm/PBText.js.map +0 -1
- package/src/_esm/PlotBoilerplate.d.ts +0 -899
- package/src/_esm/PlotBoilerplate.js +0 -2347
- package/src/_esm/PlotBoilerplate.js.map +0 -1
- package/src/_esm/Polygon.d.ts +0 -520
- package/src/_esm/Polygon.js +0 -924
- package/src/_esm/Polygon.js.map +0 -1
- package/src/_esm/SVGBuilder.d.ts +0 -47
- package/src/_esm/SVGBuilder.js +0 -95
- package/src/_esm/SVGBuilder.js.map +0 -1
- package/src/_esm/Triangle.d.ts +0 -392
- package/src/_esm/Triangle.js +0 -493
- package/src/_esm/Triangle.js.map +0 -1
- package/src/_esm/UIDGenerator.d.ts +0 -12
- package/src/_esm/UIDGenerator.js +0 -18
- package/src/_esm/UIDGenerator.js.map +0 -1
- package/src/_esm/VEllipse.d.ts +0 -319
- package/src/_esm/VEllipse.js +0 -574
- package/src/_esm/VEllipse.js.map +0 -1
- package/src/_esm/VEllipseSector.d.ts +0 -230
- package/src/_esm/VEllipseSector.js +0 -422
- package/src/_esm/VEllipseSector.js.map +0 -1
- package/src/_esm/Vector.d.ts +0 -126
- package/src/_esm/Vector.js +0 -181
- package/src/_esm/Vector.js.map +0 -1
- package/src/_esm/VertTuple.d.ts +0 -284
- package/src/_esm/VertTuple.js +0 -347
- package/src/_esm/VertTuple.js.map +0 -1
- package/src/_esm/Vertex.d.ts +0 -498
- package/src/_esm/Vertex.js +0 -702
- package/src/_esm/Vertex.js.map +0 -1
- package/src/_esm/VertexAttr.d.ts +0 -72
- package/src/_esm/VertexAttr.js +0 -58
- package/src/_esm/VertexAttr.js.map +0 -1
- package/src/_esm/VertexListeners.d.ts +0 -209
- package/src/_esm/VertexListeners.js +0 -270
- package/src/_esm/VertexListeners.js.map +0 -1
- package/src/_esm/draw.d.ts +0 -657
- package/src/_esm/draw.js +0 -1159
- package/src/_esm/draw.js.map +0 -1
- package/src/_esm/drawgl.d.ts +0 -544
- package/src/_esm/drawgl.js +0 -812
- package/src/_esm/drawgl.js.map +0 -1
- package/src/_esm/drawutilssvg.d.ts +0 -954
- package/src/_esm/drawutilssvg.js +0 -1705
- package/src/_esm/drawutilssvg.js.map +0 -1
- package/src/_esm/entry-glsupport.js +0 -28
- package/src/_esm/entry.js +0 -29
- package/src/_esm/geomutils.d.ts +0 -77
- package/src/_esm/geomutils.js +0 -126
- package/src/_esm/geomutils.js.map +0 -1
- package/src/_esm/index.d.ts +0 -102
- package/src/_esm/index.js +0 -128
- package/src/_esm/index.js.map +0 -1
- package/src/_esm/interfaces/DrawLib.d.ts +0 -582
- package/src/_esm/interfaces/DrawLib.js +0 -32
- package/src/_esm/interfaces/DrawLib.js.map +0 -1
- package/src/_esm/interfaces/additionals.d.ts +0 -95
- package/src/_esm/interfaces/additionals.js +0 -3
- package/src/_esm/interfaces/additionals.js.map +0 -1
- package/src/_esm/interfaces/core.d.ts +0 -286
- package/src/_esm/interfaces/core.js +0 -30
- package/src/_esm/interfaces/core.js.map +0 -1
- package/src/_esm/interfaces/externals.d.ts +0 -56
- package/src/_esm/interfaces/externals.js +0 -8
- package/src/_esm/interfaces/externals.js.map +0 -1
- package/src/_esm/interfaces/index.d.ts +0 -4
- package/src/_esm/interfaces/index.js +0 -21
- package/src/_esm/interfaces/index.js.map +0 -1
- package/src/_esm/module.d.ts +0 -26
- package/src/_esm/module.js +0 -60
- package/src/_esm/module.js.map +0 -1
- package/src/_esm/src/ts/BezierPath.d.ts +0 -610
- package/src/_esm/src/ts/BezierPath.js +0 -1120
- package/src/_esm/src/ts/BezierPath.js.map +0 -1
- package/src/_esm/src/ts/Bounds.d.ts +0 -252
- package/src/_esm/src/ts/Bounds.js +0 -313
- package/src/_esm/src/ts/Bounds.js.map +0 -1
- package/src/_esm/src/ts/Circle.d.ts +0 -214
- package/src/_esm/src/ts/Circle.js +0 -331
- package/src/_esm/src/ts/Circle.js.map +0 -1
- package/src/_esm/src/ts/CircleSector.d.ts +0 -211
- package/src/_esm/src/ts/CircleSector.js +0 -355
- package/src/_esm/src/ts/CircleSector.js.map +0 -1
- package/src/_esm/src/ts/CubicBezierCurve.d.ts +0 -656
- package/src/_esm/src/ts/CubicBezierCurve.js +0 -1053
- package/src/_esm/src/ts/CubicBezierCurve.js.map +0 -1
- package/src/_esm/src/ts/Grid.d.ts +0 -83
- package/src/_esm/src/ts/Grid.js +0 -85
- package/src/_esm/src/ts/Grid.js.map +0 -1
- package/src/_esm/src/ts/KeyHandler.d.ts +0 -177
- package/src/_esm/src/ts/KeyHandler.js +0 -430
- package/src/_esm/src/ts/KeyHandler.js.map +0 -1
- package/src/_esm/src/ts/Line.d.ts +0 -134
- package/src/_esm/src/ts/Line.js +0 -196
- package/src/_esm/src/ts/Line.js.map +0 -1
- package/src/_esm/src/ts/MouseHandler.d.ts +0 -283
- package/src/_esm/src/ts/MouseHandler.js +0 -391
- package/src/_esm/src/ts/MouseHandler.js.map +0 -1
- package/src/_esm/src/ts/PBImage.d.ts +0 -81
- package/src/_esm/src/ts/PBImage.js +0 -56
- package/src/_esm/src/ts/PBImage.js.map +0 -1
- package/src/_esm/src/ts/PBText.d.ts +0 -118
- package/src/_esm/src/ts/PBText.js +0 -58
- package/src/_esm/src/ts/PBText.js.map +0 -1
- package/src/_esm/src/ts/PlotBoilerplate.d.ts +0 -899
- package/src/_esm/src/ts/PlotBoilerplate.js +0 -2340
- package/src/_esm/src/ts/PlotBoilerplate.js.map +0 -1
- package/src/_esm/src/ts/Polygon.d.ts +0 -520
- package/src/_esm/src/ts/Polygon.js +0 -920
- package/src/_esm/src/ts/Polygon.js.map +0 -1
- package/src/_esm/src/ts/Triangle.d.ts +0 -392
- package/src/_esm/src/ts/Triangle.js +0 -489
- package/src/_esm/src/ts/Triangle.js.map +0 -1
- package/src/_esm/src/ts/UIDGenerator.d.ts +0 -12
- package/src/_esm/src/ts/UIDGenerator.js +0 -14
- package/src/_esm/src/ts/UIDGenerator.js.map +0 -1
- package/src/_esm/src/ts/VEllipse.d.ts +0 -319
- package/src/_esm/src/ts/VEllipse.js +0 -570
- package/src/_esm/src/ts/VEllipse.js.map +0 -1
- package/src/_esm/src/ts/VEllipseSector.d.ts +0 -230
- package/src/_esm/src/ts/VEllipseSector.js +0 -418
- package/src/_esm/src/ts/VEllipseSector.js.map +0 -1
- package/src/_esm/src/ts/Vector.d.ts +0 -126
- package/src/_esm/src/ts/Vector.js +0 -177
- package/src/_esm/src/ts/Vector.js.map +0 -1
- package/src/_esm/src/ts/VertTuple.d.ts +0 -284
- package/src/_esm/src/ts/VertTuple.js +0 -343
- package/src/_esm/src/ts/VertTuple.js.map +0 -1
- package/src/_esm/src/ts/Vertex.d.ts +0 -498
- package/src/_esm/src/ts/Vertex.js +0 -698
- package/src/_esm/src/ts/Vertex.js.map +0 -1
- package/src/_esm/src/ts/VertexAttr.d.ts +0 -72
- package/src/_esm/src/ts/VertexAttr.js +0 -54
- package/src/_esm/src/ts/VertexAttr.js.map +0 -1
- package/src/_esm/src/ts/VertexListeners.d.ts +0 -209
- package/src/_esm/src/ts/VertexListeners.js +0 -266
- package/src/_esm/src/ts/VertexListeners.js.map +0 -1
- package/src/_esm/src/ts/draw.d.ts +0 -657
- package/src/_esm/src/ts/draw.js +0 -1155
- package/src/_esm/src/ts/draw.js.map +0 -1
- package/src/_esm/src/ts/drawgl.d.ts +0 -544
- package/src/_esm/src/ts/drawgl.js +0 -808
- package/src/_esm/src/ts/drawgl.js.map +0 -1
- package/src/_esm/src/ts/drawutilssvg.d.ts +0 -954
- package/src/_esm/src/ts/drawutilssvg.js +0 -1701
- package/src/_esm/src/ts/drawutilssvg.js.map +0 -1
- package/src/_esm/src/ts/geomutils.d.ts +0 -77
- package/src/_esm/src/ts/geomutils.js +0 -123
- package/src/_esm/src/ts/geomutils.js.map +0 -1
- package/src/_esm/src/ts/index.d.ts +0 -102
- package/src/_esm/src/ts/index.js +0 -112
- package/src/_esm/src/ts/index.js.map +0 -1
- package/src/_esm/src/ts/interfaces/DrawLib.d.ts +0 -582
- package/src/_esm/src/ts/interfaces/DrawLib.js +0 -31
- package/src/_esm/src/ts/interfaces/DrawLib.js.map +0 -1
- package/src/_esm/src/ts/interfaces/additionals.d.ts +0 -95
- package/src/_esm/src/ts/interfaces/additionals.js +0 -2
- package/src/_esm/src/ts/interfaces/additionals.js.map +0 -1
- package/src/_esm/src/ts/interfaces/core.d.ts +0 -286
- package/src/_esm/src/ts/interfaces/core.js +0 -29
- package/src/_esm/src/ts/interfaces/core.js.map +0 -1
- package/src/_esm/src/ts/interfaces/externals.d.ts +0 -56
- package/src/_esm/src/ts/interfaces/externals.js +0 -7
- package/src/_esm/src/ts/interfaces/externals.js.map +0 -1
- package/src/_esm/src/ts/interfaces/index.d.ts +0 -4
- package/src/_esm/src/ts/interfaces/index.js +0 -5
- package/src/_esm/src/ts/interfaces/index.js.map +0 -1
- package/src/_esm/src/ts/module.d.ts +0 -26
- package/src/_esm/src/ts/module.js +0 -38
- package/src/_esm/src/ts/module.js.map +0 -1
- package/src/_esm/src/ts/utils/InitializationObserver.d.ts +0 -18
- package/src/_esm/src/ts/utils/InitializationObserver.js +0 -57
- package/src/_esm/src/ts/utils/InitializationObserver.js.map +0 -1
- package/src/_esm/src/ts/utils/LissajousFigure.d.ts +0 -34
- package/src/_esm/src/ts/utils/LissajousFigure.js +0 -95
- package/src/_esm/src/ts/utils/LissajousFigure.js.map +0 -1
- package/src/_esm/src/ts/utils/NGons.d.ts +0 -13
- package/src/_esm/src/ts/utils/NGons.js +0 -33
- package/src/_esm/src/ts/utils/NGons.js.map +0 -1
- package/src/_esm/src/ts/utils/Params.d.ts +0 -17
- package/src/_esm/src/ts/utils/Params.js +0 -48
- package/src/_esm/src/ts/utils/Params.js.map +0 -1
- package/src/_esm/src/ts/utils/PerlinNoise.d.ts +0 -19
- package/src/_esm/src/ts/utils/PerlinNoise.js +0 -346
- package/src/_esm/src/ts/utils/PerlinNoise.js.map +0 -1
- package/src/_esm/src/ts/utils/SVGPathUtils.d.ts +0 -22
- package/src/_esm/src/ts/utils/SVGPathUtils.js +0 -42
- package/src/_esm/src/ts/utils/SVGPathUtils.js.map +0 -1
- package/src/_esm/src/ts/utils/WebColors.d.ts +0 -35
- package/src/_esm/src/ts/utils/WebColors.js +0 -54
- package/src/_esm/src/ts/utils/WebColors.js.map +0 -1
- package/src/_esm/src/ts/utils/WebColorsContrast.d.ts +0 -6
- package/src/_esm/src/ts/utils/WebColorsContrast.js +0 -9
- package/src/_esm/src/ts/utils/WebColorsContrast.js.map +0 -1
- package/src/_esm/src/ts/utils/WebColorsMalachite.d.ts +0 -12
- package/src/_esm/src/ts/utils/WebColorsMalachite.js +0 -25
- package/src/_esm/src/ts/utils/WebColorsMalachite.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.d.ts +0 -60
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js +0 -103
- package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.d.ts +0 -170
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js +0 -303
- package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.d.ts +0 -150
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js +0 -362
- package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.d.ts +0 -63
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js +0 -170
- package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.d.ts +0 -81
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.js +0 -273
- package/src/_esm/src/ts/utils/algorithms/HobbyPath.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/Metaballs.d.ts +0 -30
- package/src/_esm/src/ts/utils/algorithms/Metaballs.js +0 -109
- package/src/_esm/src/ts/utils/algorithms/Metaballs.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.d.ts +0 -184
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.js +0 -424
- package/src/_esm/src/ts/utils/algorithms/PolygonInset.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js +0 -262
- package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/arrayFill.d.ts +0 -8
- package/src/_esm/src/ts/utils/algorithms/arrayFill.js +0 -14
- package/src/_esm/src/ts/utils/algorithms/arrayFill.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/arrayResize.d.ts +0 -8
- package/src/_esm/src/ts/utils/algorithms/arrayResize.js +0 -20
- package/src/_esm/src/ts/utils/algorithms/arrayResize.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.d.ts +0 -8
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js +0 -11
- package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js +0 -47
- package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js +0 -57
- package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/convexHull.d.ts +0 -23
- package/src/_esm/src/ts/utils/algorithms/convexHull.js +0 -67
- package/src/_esm/src/ts/utils/algorithms/convexHull.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js +0 -141
- package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/delaunay.d.ts +0 -30
- package/src/_esm/src/ts/utils/algorithms/delaunay.js +0 -153
- package/src/_esm/src/ts/utils/algorithms/delaunay.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.d.ts +0 -25
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js +0 -99
- package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/detectPaths.d.ts +0 -21
- package/src/_esm/src/ts/utils/algorithms/detectPaths.js +0 -165
- package/src/_esm/src/ts/utils/algorithms/detectPaths.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js +0 -47
- package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.d.ts +0 -13
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.js +0 -22
- package/src/_esm/src/ts/utils/algorithms/getContrastColor.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/matrixFill.d.ts +0 -10
- package/src/_esm/src/ts/utils/algorithms/matrixFill.js +0 -17
- package/src/_esm/src/ts/utils/algorithms/matrixFill.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js +0 -266
- package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js +0 -99
- package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.d.ts +0 -16
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js +0 -72
- package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js.map +0 -1
- package/src/_esm/src/ts/utils/cloneVertexArray.d.ts +0 -13
- package/src/_esm/src/ts/utils/cloneVertexArray.js +0 -19
- package/src/_esm/src/ts/utils/cloneVertexArray.js.map +0 -1
- package/src/_esm/src/ts/utils/createRandomizedPolygon.d.ts +0 -14
- package/src/_esm/src/ts/utils/createRandomizedPolygon.js +0 -28
- package/src/_esm/src/ts/utils/createRandomizedPolygon.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.d.ts +0 -83
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js +0 -158
- package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/Color.d.ts +0 -391
- package/src/_esm/src/ts/utils/datastructures/Color.js +0 -1063
- package/src/_esm/src/ts/utils/datastructures/Color.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.d.ts +0 -81
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.js +0 -171
- package/src/_esm/src/ts/utils/datastructures/ColorGradient.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.d.ts +0 -53
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js +0 -19
- package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js +0 -150
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js +0 -79
- package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GenericPath.d.ts +0 -86
- package/src/_esm/src/ts/utils/datastructures/GenericPath.js +0 -117
- package/src/_esm/src/ts/utils/datastructures/GenericPath.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.d.ts +0 -49
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js +0 -53
- package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/Girih.d.ts +0 -181
- package/src/_esm/src/ts/utils/datastructures/Girih.js +0 -261
- package/src/_esm/src/ts/utils/datastructures/Girih.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.d.ts +0 -37
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js +0 -130
- package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.d.ts +0 -52
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js +0 -110
- package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.d.ts +0 -39
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js +0 -178
- package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js +0 -167
- package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.d.ts +0 -37
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js +0 -87
- package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.d.ts +0 -38
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js +0 -133
- package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/GirihTile.d.ts +0 -283
- package/src/_esm/src/ts/utils/datastructures/GirihTile.js +0 -286
- package/src/_esm/src/ts/utils/datastructures/GirihTile.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.d.ts +0 -244
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js +0 -246
- package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.d.ts +0 -122
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js +0 -178
- package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js.map +0 -1
- package/src/_esm/src/ts/utils/datastructures/interfaces.d.ts +0 -13
- package/src/_esm/src/ts/utils/datastructures/interfaces.js +0 -9
- package/src/_esm/src/ts/utils/datastructures/interfaces.js.map +0 -1
- package/src/_esm/src/ts/utils/detectDarkMode.d.ts +0 -10
- package/src/_esm/src/ts/utils/detectDarkMode.js +0 -37
- package/src/_esm/src/ts/utils/detectDarkMode.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.d.ts +0 -246
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js +0 -743
- package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.d.ts +0 -118
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js +0 -339
- package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/components/Test.d.ts +0 -7
- package/src/_esm/src/ts/utils/dom/components/Test.js +0 -26
- package/src/_esm/src/ts/utils/dom/components/Test.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.d.ts +0 -2
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js +0 -25
- package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/getFProp.d.ts +0 -5
- package/src/_esm/src/ts/utils/dom/getFProp.js +0 -8
- package/src/_esm/src/ts/utils/dom/getFProp.js.map +0 -1
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.d.ts +0 -18
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.js +0 -40
- package/src/_esm/src/ts/utils/dom/guiSizeToggler.js.map +0 -1
- package/src/_esm/src/ts/utils/findInVertexArray.d.ts +0 -19
- package/src/_esm/src/ts/utils/findInVertexArray.js +0 -25
- package/src/_esm/src/ts/utils/findInVertexArray.js.map +0 -1
- package/src/_esm/src/ts/utils/gup.d.ts +0 -14
- package/src/_esm/src/ts/utils/gup.js +0 -27
- package/src/_esm/src/ts/utils/gup.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js +0 -648
- package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/CircleHelper.d.ts +0 -73
- package/src/_esm/src/ts/utils/helpers/CircleHelper.js +0 -88
- package/src/_esm/src/ts/utils/helpers/CircleHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.d.ts +0 -90
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js +0 -109
- package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.d.ts +0 -57
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.js +0 -78
- package/src/_esm/src/ts/utils/helpers/TriangleHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.d.ts +0 -32
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js +0 -83
- package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js +0 -130
- package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js.map +0 -1
- package/src/_esm/src/ts/utils/io/FileDrop.d.ts +0 -110
- package/src/_esm/src/ts/utils/io/FileDrop.js +0 -171
- package/src/_esm/src/ts/utils/io/FileDrop.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.d.ts +0 -78
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js +0 -217
- package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/OBJParser.d.ts +0 -24
- package/src/_esm/src/ts/utils/parsers/OBJParser.js +0 -72
- package/src/_esm/src/ts/utils/parsers/OBJParser.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/STLParser.d.ts +0 -61
- package/src/_esm/src/ts/utils/parsers/STLParser.js +0 -175
- package/src/_esm/src/ts/utils/parsers/STLParser.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js +0 -482
- package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js +0 -49
- package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js.map +0 -1
- package/src/_esm/src/ts/utils/parsers/svg/types.d.ts +0 -63
- package/src/_esm/src/ts/utils/parsers/svg/types.js +0 -16
- package/src/_esm/src/ts/utils/parsers/svg/types.js.map +0 -1
- package/src/_esm/utils/InitializationObserver.d.ts +0 -18
- package/src/_esm/utils/InitializationObserver.js +0 -61
- package/src/_esm/utils/InitializationObserver.js.map +0 -1
- package/src/_esm/utils/LissajousFigure.d.ts +0 -34
- package/src/_esm/utils/LissajousFigure.js +0 -99
- package/src/_esm/utils/LissajousFigure.js.map +0 -1
- package/src/_esm/utils/NGons.d.ts +0 -13
- package/src/_esm/utils/NGons.js +0 -36
- package/src/_esm/utils/NGons.js.map +0 -1
- package/src/_esm/utils/Params.d.ts +0 -17
- package/src/_esm/utils/Params.js +0 -52
- package/src/_esm/utils/Params.js.map +0 -1
- package/src/_esm/utils/PerlinNoise.d.ts +0 -19
- package/src/_esm/utils/PerlinNoise.js +0 -350
- package/src/_esm/utils/PerlinNoise.js.map +0 -1
- package/src/_esm/utils/SVGPathUtils.d.ts +0 -22
- package/src/_esm/utils/SVGPathUtils.js +0 -45
- package/src/_esm/utils/SVGPathUtils.js.map +0 -1
- package/src/_esm/utils/WebColors.d.ts +0 -35
- package/src/_esm/utils/WebColors.js +0 -58
- package/src/_esm/utils/WebColors.js.map +0 -1
- package/src/_esm/utils/WebColorsContrast.d.ts +0 -6
- package/src/_esm/utils/WebColorsContrast.js +0 -12
- package/src/_esm/utils/WebColorsContrast.js.map +0 -1
- package/src/_esm/utils/WebColorsMalachite.d.ts +0 -12
- package/src/_esm/utils/WebColorsMalachite.js +0 -28
- package/src/_esm/utils/WebColorsMalachite.js.map +0 -1
- package/src/_esm/utils/algorithms/CatmullRomPath.d.ts +0 -60
- package/src/_esm/utils/algorithms/CatmullRomPath.js +0 -107
- package/src/_esm/utils/algorithms/CatmullRomPath.js.map +0 -1
- package/src/_esm/utils/algorithms/CircleIntersections.d.ts +0 -170
- package/src/_esm/utils/algorithms/CircleIntersections.js +0 -307
- package/src/_esm/utils/algorithms/CircleIntersections.js.map +0 -1
- package/src/_esm/utils/algorithms/ContourLineDetection.d.ts +0 -150
- package/src/_esm/utils/algorithms/ContourLineDetection.js +0 -366
- package/src/_esm/utils/algorithms/ContourLineDetection.js.map +0 -1
- package/src/_esm/utils/algorithms/CubicSplinePath.d.ts +0 -63
- package/src/_esm/utils/algorithms/CubicSplinePath.js +0 -174
- package/src/_esm/utils/algorithms/CubicSplinePath.js.map +0 -1
- package/src/_esm/utils/algorithms/HobbyPath.d.ts +0 -81
- package/src/_esm/utils/algorithms/HobbyPath.js +0 -277
- package/src/_esm/utils/algorithms/HobbyPath.js.map +0 -1
- package/src/_esm/utils/algorithms/Metaballs.d.ts +0 -30
- package/src/_esm/utils/algorithms/Metaballs.js +0 -113
- package/src/_esm/utils/algorithms/Metaballs.js.map +0 -1
- package/src/_esm/utils/algorithms/PolygonInset.d.ts +0 -184
- package/src/_esm/utils/algorithms/PolygonInset.js +0 -428
- package/src/_esm/utils/algorithms/PolygonInset.js.map +0 -1
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js +0 -267
- package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
- package/src/_esm/utils/algorithms/arrayFill.d.ts +0 -8
- package/src/_esm/utils/algorithms/arrayFill.js +0 -18
- package/src/_esm/utils/algorithms/arrayFill.js.map +0 -1
- package/src/_esm/utils/algorithms/arrayResize.d.ts +0 -8
- package/src/_esm/utils/algorithms/arrayResize.js +0 -24
- package/src/_esm/utils/algorithms/arrayResize.js.map +0 -1
- package/src/_esm/utils/algorithms/arrayShuffle.d.ts +0 -8
- package/src/_esm/utils/algorithms/arrayShuffle.js +0 -15
- package/src/_esm/utils/algorithms/arrayShuffle.js.map +0 -1
- package/src/_esm/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
- package/src/_esm/utils/algorithms/clearDuplicateVertices.js +0 -51
- package/src/_esm/utils/algorithms/clearDuplicateVertices.js.map +0 -1
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js +0 -61
- package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
- package/src/_esm/utils/algorithms/convexHull.d.ts +0 -23
- package/src/_esm/utils/algorithms/convexHull.js +0 -71
- package/src/_esm/utils/algorithms/convexHull.js.map +0 -1
- package/src/_esm/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
- package/src/_esm/utils/algorithms/convexPolygonIncircle.js +0 -145
- package/src/_esm/utils/algorithms/convexPolygonIncircle.js.map +0 -1
- package/src/_esm/utils/algorithms/createRandomizedPolygon.d.ts +0 -14
- package/src/_esm/utils/algorithms/createRandomizedPolygon.js +0 -28
- package/src/_esm/utils/algorithms/createRandomizedPolygon.js.map +0 -1
- package/src/_esm/utils/algorithms/delaunay.d.ts +0 -30
- package/src/_esm/utils/algorithms/delaunay.js +0 -157
- package/src/_esm/utils/algorithms/delaunay.js.map +0 -1
- package/src/_esm/utils/algorithms/delaunay2voronoi.d.ts +0 -25
- package/src/_esm/utils/algorithms/delaunay2voronoi.js +0 -103
- package/src/_esm/utils/algorithms/delaunay2voronoi.js.map +0 -1
- package/src/_esm/utils/algorithms/detectPaths.d.ts +0 -21
- package/src/_esm/utils/algorithms/detectPaths.js +0 -169
- package/src/_esm/utils/algorithms/detectPaths.js.map +0 -1
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js +0 -51
- package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
- package/src/_esm/utils/algorithms/getContrastColor.d.ts +0 -13
- package/src/_esm/utils/algorithms/getContrastColor.js +0 -26
- package/src/_esm/utils/algorithms/getContrastColor.js.map +0 -1
- package/src/_esm/utils/algorithms/matrixFill.d.ts +0 -10
- package/src/_esm/utils/algorithms/matrixFill.js +0 -21
- package/src/_esm/utils/algorithms/matrixFill.js.map +0 -1
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js +0 -270
- package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js +0 -102
- package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
- package/src/_esm/utils/algorithms/sutherlandHodgman.d.ts +0 -16
- package/src/_esm/utils/algorithms/sutherlandHodgman.js +0 -76
- package/src/_esm/utils/algorithms/sutherlandHodgman.js.map +0 -1
- package/src/_esm/utils/cloneVertexArray.d.ts +0 -13
- package/src/_esm/utils/cloneVertexArray.js +0 -23
- package/src/_esm/utils/cloneVertexArray.js.map +0 -1
- package/src/_esm/utils/createRandomizedPolygon.d.ts +0 -14
- package/src/_esm/utils/createRandomizedPolygon.js +0 -32
- package/src/_esm/utils/createRandomizedPolygon.js.map +0 -1
- package/src/_esm/utils/datastructures/CircularIntervalSet.d.ts +0 -83
- package/src/_esm/utils/datastructures/CircularIntervalSet.js +0 -162
- package/src/_esm/utils/datastructures/CircularIntervalSet.js.map +0 -1
- package/src/_esm/utils/datastructures/Color.d.ts +0 -391
- package/src/_esm/utils/datastructures/Color.js +0 -1067
- package/src/_esm/utils/datastructures/Color.js.map +0 -1
- package/src/_esm/utils/datastructures/ColorGradient.d.ts +0 -81
- package/src/_esm/utils/datastructures/ColorGradient.js +0 -175
- package/src/_esm/utils/datastructures/ColorGradient.js.map +0 -1
- package/src/_esm/utils/datastructures/DataGrid2d.d.ts +0 -53
- package/src/_esm/utils/datastructures/DataGrid2d.js +0 -20
- package/src/_esm/utils/datastructures/DataGrid2d.js.map +0 -1
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js +0 -154
- package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js +0 -83
- package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
- package/src/_esm/utils/datastructures/GenericPath.d.ts +0 -86
- package/src/_esm/utils/datastructures/GenericPath.js +0 -121
- package/src/_esm/utils/datastructures/GenericPath.js.map +0 -1
- package/src/_esm/utils/datastructures/GeometryMesh.d.ts +0 -49
- package/src/_esm/utils/datastructures/GeometryMesh.js +0 -57
- package/src/_esm/utils/datastructures/GeometryMesh.js.map +0 -1
- package/src/_esm/utils/datastructures/Girih.d.ts +0 -181
- package/src/_esm/utils/datastructures/Girih.js +0 -265
- package/src/_esm/utils/datastructures/Girih.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihBowtie.d.ts +0 -37
- package/src/_esm/utils/datastructures/GirihBowtie.js +0 -134
- package/src/_esm/utils/datastructures/GirihBowtie.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihDecagon.d.ts +0 -52
- package/src/_esm/utils/datastructures/GirihDecagon.js +0 -114
- package/src/_esm/utils/datastructures/GirihDecagon.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihHexagon.d.ts +0 -39
- package/src/_esm/utils/datastructures/GirihHexagon.js +0 -182
- package/src/_esm/utils/datastructures/GirihHexagon.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.js +0 -171
- package/src/_esm/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihPentagon.d.ts +0 -37
- package/src/_esm/utils/datastructures/GirihPentagon.js +0 -91
- package/src/_esm/utils/datastructures/GirihPentagon.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihRhombus.d.ts +0 -38
- package/src/_esm/utils/datastructures/GirihRhombus.js +0 -137
- package/src/_esm/utils/datastructures/GirihRhombus.js.map +0 -1
- package/src/_esm/utils/datastructures/GirihTile.d.ts +0 -283
- package/src/_esm/utils/datastructures/GirihTile.js +0 -290
- package/src/_esm/utils/datastructures/GirihTile.js.map +0 -1
- package/src/_esm/utils/datastructures/Matrix4x4.d.ts +0 -244
- package/src/_esm/utils/datastructures/Matrix4x4.js +0 -250
- package/src/_esm/utils/datastructures/Matrix4x4.js.map +0 -1
- package/src/_esm/utils/datastructures/VoronoiCell.d.ts +0 -122
- package/src/_esm/utils/datastructures/VoronoiCell.js +0 -182
- package/src/_esm/utils/datastructures/VoronoiCell.js.map +0 -1
- package/src/_esm/utils/datastructures/interfaces.d.ts +0 -13
- package/src/_esm/utils/datastructures/interfaces.js +0 -10
- package/src/_esm/utils/datastructures/interfaces.js.map +0 -1
- package/src/_esm/utils/detectDarkMode.d.ts +0 -10
- package/src/_esm/utils/detectDarkMode.js +0 -41
- package/src/_esm/utils/detectDarkMode.js.map +0 -1
- package/src/_esm/utils/dom/components/ColorGradientPicker.d.ts +0 -246
- package/src/_esm/utils/dom/components/ColorGradientPicker.js +0 -780
- package/src/_esm/utils/dom/components/ColorGradientPicker.js.map +0 -1
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.d.ts +0 -129
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js +0 -582
- package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js.map +0 -1
- package/src/_esm/utils/dom/components/ColorGradientSelector.d.ts +0 -118
- package/src/_esm/utils/dom/components/ColorGradientSelector.js +0 -376
- package/src/_esm/utils/dom/components/ColorGradientSelector.js.map +0 -1
- package/src/_esm/utils/dom/components/Test.d.ts +0 -7
- package/src/_esm/utils/dom/components/Test.js +0 -63
- package/src/_esm/utils/dom/components/Test.js.map +0 -1
- package/src/_esm/utils/dom/getAvailableContainerSpace.d.ts +0 -2
- package/src/_esm/utils/dom/getAvailableContainerSpace.js +0 -29
- package/src/_esm/utils/dom/getAvailableContainerSpace.js.map +0 -1
- package/src/_esm/utils/dom/getFProp.d.ts +0 -5
- package/src/_esm/utils/dom/getFProp.js +0 -12
- package/src/_esm/utils/dom/getFProp.js.map +0 -1
- package/src/_esm/utils/dom/guiSizeToggler.d.ts +0 -18
- package/src/_esm/utils/dom/guiSizeToggler.js +0 -44
- package/src/_esm/utils/dom/guiSizeToggler.js.map +0 -1
- package/src/_esm/utils/findInVertexArray.d.ts +0 -19
- package/src/_esm/utils/findInVertexArray.js +0 -29
- package/src/_esm/utils/findInVertexArray.js.map +0 -1
- package/src/_esm/utils/getFProp.d.ts +0 -5
- package/src/_esm/utils/getFProp.js +0 -8
- package/src/_esm/utils/getFProp.js.map +0 -1
- package/src/_esm/utils/gup.d.ts +0 -14
- package/src/_esm/utils/gup.js +0 -31
- package/src/_esm/utils/gup.js.map +0 -1
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.js +0 -655
- package/src/_esm/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
- package/src/_esm/utils/helpers/CircleHelper.d.ts +0 -73
- package/src/_esm/utils/helpers/CircleHelper.js +0 -92
- package/src/_esm/utils/helpers/CircleHelper.js.map +0 -1
- package/src/_esm/utils/helpers/CircleSectorHelper.d.ts +0 -90
- package/src/_esm/utils/helpers/CircleSectorHelper.js +0 -113
- package/src/_esm/utils/helpers/CircleSectorHelper.js.map +0 -1
- package/src/_esm/utils/helpers/TriangleHelper.d.ts +0 -57
- package/src/_esm/utils/helpers/TriangleHelper.js +0 -82
- package/src/_esm/utils/helpers/TriangleHelper.js.map +0 -1
- package/src/_esm/utils/helpers/VEllipseHelper.d.ts +0 -32
- package/src/_esm/utils/helpers/VEllipseHelper.js +0 -87
- package/src/_esm/utils/helpers/VEllipseHelper.js.map +0 -1
- package/src/_esm/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
- package/src/_esm/utils/helpers/VEllipseSectorHelper.js +0 -134
- package/src/_esm/utils/helpers/VEllipseSectorHelper.js.map +0 -1
- package/src/_esm/utils/io/DndFileHandler.d.ts +0 -63
- package/src/_esm/utils/io/DndFileHandler.js +0 -106
- package/src/_esm/utils/io/DndFileHandler.js.map +0 -1
- package/src/_esm/utils/io/FileDrop.d.ts +0 -110
- package/src/_esm/utils/io/FileDrop.js +0 -175
- package/src/_esm/utils/io/FileDrop.js.map +0 -1
- package/src/_esm/utils/parsers/LinearColorGradientParser.d.ts +0 -78
- package/src/_esm/utils/parsers/LinearColorGradientParser.js +0 -223
- package/src/_esm/utils/parsers/LinearColorGradientParser.js.map +0 -1
- package/src/_esm/utils/parsers/OBJParser.d.ts +0 -25
- package/src/_esm/utils/parsers/OBJParser.js +0 -78
- package/src/_esm/utils/parsers/OBJParser.js.map +0 -1
- package/src/_esm/utils/parsers/STLParser.d.ts +0 -61
- package/src/_esm/utils/parsers/STLParser.js +0 -179
- package/src/_esm/utils/parsers/STLParser.js.map +0 -1
- package/src/_esm/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
- package/src/_esm/utils/parsers/svg/parseSVGPathData.js +0 -486
- package/src/_esm/utils/parsers/svg/parseSVGPathData.js.map +0 -1
- package/src/_esm/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
- package/src/_esm/utils/parsers/svg/splitSVGPathData.js +0 -53
- package/src/_esm/utils/parsers/svg/splitSVGPathData.js.map +0 -1
- package/src/_esm/utils/parsers/svg/types.d.ts +0 -63
- package/src/_esm/utils/parsers/svg/types.js +0 -17
- package/src/_esm/utils/parsers/svg/types.js.map +0 -1
package/src/_cjs/drawutilssvg.js
DELETED
|
@@ -1,1713 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Draws elements into an SVG node.
|
|
4
|
-
*
|
|
5
|
-
* Note that this library uses buffers and draw cycles. To draw onto an SVG canvas, do this:
|
|
6
|
-
* const drawLib = new drawutilssvg( svgNode, ... );
|
|
7
|
-
* const fillLib = drawLib.copyInstance(true);
|
|
8
|
-
* // Begin draw cycle
|
|
9
|
-
* drawLib.beginDrawCycle(time);
|
|
10
|
-
* // ... draw or fill your stuff ...
|
|
11
|
-
* drawLib.endDrawCycle(time); // Here the elements become visible
|
|
12
|
-
*
|
|
13
|
-
* @author Ikaros Kappler
|
|
14
|
-
* @date 2021-01-03
|
|
15
|
-
* @modified 2021-01-24 Fixed the `fillShapes` attribute in the copyInstance function.
|
|
16
|
-
* @modified 2021-01-26 Changed the `isPrimary` (default true) attribute to `isSecondary` (default false).
|
|
17
|
-
* @modified 2021-02-03 Added the static `createSvg` function.
|
|
18
|
-
* @modified 2021-02-03 Fixed the currentId='background' bug on the clear() function.
|
|
19
|
-
* @modified 2021-02-03 Fixed CSSProperty `stroke-width` (was line-width before, which is wrong).
|
|
20
|
-
* @modified 2021-02-03 Added the static `HEAD_XML` attribute.
|
|
21
|
-
* @modified 2021-02-19 Added the static helper function `transformPathData(...)` for svg path transformations (scale and translate).
|
|
22
|
-
* @modified 2021-02-22 Added the static helper function `copyPathData(...)`.
|
|
23
|
-
* @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.
|
|
24
|
-
* @modified 2021-03-01 Fixed a bug in the `clear` function (curClassName was not cleared).
|
|
25
|
-
* @modified 2021-03-29 Fixed a bug in the `text` function (second y param was wrong, used x here).
|
|
26
|
-
* @modified 2021-03-29 Moved this file from `src/ts/utils/helpers/` to `src/ts/`.
|
|
27
|
-
* @modified 2021-03-31 Added 'ellipseSector' the the class names.
|
|
28
|
-
* @modified 2021-03-31 Implemented buffering using a buffer <g> node and the beginDrawCycle and endDrawCycle methods.
|
|
29
|
-
* @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.
|
|
30
|
-
* @modified 2021-11-15 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.
|
|
31
|
-
* @modified 2021-11-19 Fixing the `label(text,x,y)` position.
|
|
32
|
-
* @modified 2021-11-19 Added the `color` param to the `label(...)` function.
|
|
33
|
-
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
34
|
-
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
35
|
-
* @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.
|
|
36
|
-
* @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
|
|
37
|
-
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
38
|
-
* @modified 2022-11-10 Tweaking some type issues.
|
|
39
|
-
* @modified 2023-02-04 Fixed a typo in the CSS classname for cubic Bézier paths: cubicBezier (was cubierBezier).
|
|
40
|
-
* @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
|
|
41
|
-
* @modified 2023-09-29 Added initialization checks for null parameters.
|
|
42
|
-
* @modified 2023-09-29 Added a missing implementation to the `drawurilssvg.do(XYCoords,string)` function. Didn't draw anything.
|
|
43
|
-
* @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.
|
|
44
|
-
* @modified 2023-09-29 Added the `headLength` parameter to the 'DrawLib.arrow()` function.
|
|
45
|
-
* @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
|
|
46
|
-
* @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
|
|
47
|
-
* @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
|
|
48
|
-
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
49
|
-
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
50
|
-
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
51
|
-
* @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
|
|
52
|
-
* @modified 2026-01-04 Adding `lineJoin` attribute to the methods' `StrokeOptions` param.
|
|
53
|
-
* @modified 2026-01-04 Fixing missing `strokeOptions` param in the `drawutilssvg.polygon` method.
|
|
54
|
-
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
55
|
-
* @version 1.7.0
|
|
56
|
-
**/
|
|
57
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
-
exports.drawutilssvg = void 0;
|
|
59
|
-
var CircleSector_1 = require("./CircleSector");
|
|
60
|
-
var CubicBezierCurve_1 = require("./CubicBezierCurve");
|
|
61
|
-
var Vertex_1 = require("./Vertex");
|
|
62
|
-
var UIDGenerator_1 = require("./UIDGenerator");
|
|
63
|
-
var Vector_1 = require("./Vector");
|
|
64
|
-
var RAD_TO_DEG = 180 / Math.PI;
|
|
65
|
-
/**
|
|
66
|
-
* @classdesc A helper class for basic SVG drawing operations. This class should
|
|
67
|
-
* be compatible to the default 'draw' class.
|
|
68
|
-
*
|
|
69
|
-
* @requires CubicBzierCurvce
|
|
70
|
-
* @requires Polygon
|
|
71
|
-
* @requires Vertex
|
|
72
|
-
* @requires XYCoords
|
|
73
|
-
*/
|
|
74
|
-
var drawutilssvg = /** @class */ (function () {
|
|
75
|
-
/**
|
|
76
|
-
* Passed from primary to secondary instance.
|
|
77
|
-
*/
|
|
78
|
-
//private nodeStyle: SVGStyleElement;
|
|
79
|
-
/**
|
|
80
|
-
* The constructor.
|
|
81
|
-
*
|
|
82
|
-
* @constructor
|
|
83
|
-
* @name drawutilssvg
|
|
84
|
-
* @param {SVGElement} svgNode - The SVG node to use.
|
|
85
|
-
* @param {XYCoords} offset - The draw offset to use.
|
|
86
|
-
* @param {XYCoords} scale - The scale factors to use.
|
|
87
|
-
* @param {XYDimension} canvasSize - The initial canvas size (use setSize to change).
|
|
88
|
-
* @param {boolean} fillShapes - Indicates if the constructed drawutils should fill all drawn shapes (if possible).
|
|
89
|
-
* @param {DrawConfig} drawConfig - The default draw config to use for CSS fallback styles.
|
|
90
|
-
* @param {boolean=} isSecondary - (optional) Indicates if this is the primary or secondary instance. Only primary instances manage child nodes.
|
|
91
|
-
* @param {SVGGElement=} gNode - (optional) Primary and seconday instances share the same <g> node.
|
|
92
|
-
**/
|
|
93
|
-
function drawutilssvg(svgNode, offset, scale, canvasSize, fillShapes, drawConfig, isSecondary, gNode, bufferGNode, nodeDefs, bufferNodeDefs, nodeStyle) {
|
|
94
|
-
this.svgNode = svgNode;
|
|
95
|
-
this.offset = new Vertex_1.Vertex(0, 0).set(offset);
|
|
96
|
-
this.scale = new Vertex_1.Vertex(1, 1).set(scale);
|
|
97
|
-
this.fillShapes = fillShapes;
|
|
98
|
-
this.isSecondary = Boolean(isSecondary);
|
|
99
|
-
this.drawConfig = drawConfig;
|
|
100
|
-
this.drawlibConfiguration = {};
|
|
101
|
-
this.cache = new Map();
|
|
102
|
-
this.setSize(canvasSize);
|
|
103
|
-
if (isSecondary) {
|
|
104
|
-
if (!gNode || !bufferGNode || !nodeDefs || !bufferNodeDefs) {
|
|
105
|
-
throw "Cannot create secondary svg draw lib with undefinde gNode|bufferGNode|nodeDefs|bufferNodeDefs.";
|
|
106
|
-
}
|
|
107
|
-
this.gNode = gNode;
|
|
108
|
-
this.bufferGNode = bufferGNode;
|
|
109
|
-
this.nodeDefs = nodeDefs;
|
|
110
|
-
this.bufferedNodeDefs = bufferNodeDefs;
|
|
111
|
-
if (nodeStyle) {
|
|
112
|
-
this.nodeStyle = nodeStyle;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.addStyleDefs(drawConfig);
|
|
117
|
-
this.addDefsNode();
|
|
118
|
-
this.gNode = this.createSVGNode("g");
|
|
119
|
-
this.bufferGNode = this.createSVGNode("g");
|
|
120
|
-
this.svgNode.appendChild(this.gNode);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Adds a default style defintion based on the passed DrawConfig.
|
|
125
|
-
* Twaek the draw config to change default colors or line thicknesses.
|
|
126
|
-
*
|
|
127
|
-
* @param {DrawConfig} drawConfig
|
|
128
|
-
*/
|
|
129
|
-
drawutilssvg.prototype.addStyleDefs = function (drawConfig) {
|
|
130
|
-
this.nodeStyle = this.createSVGNode("style");
|
|
131
|
-
this.svgNode.appendChild(this.nodeStyle);
|
|
132
|
-
this.rebuildStyleDefs(drawConfig);
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* This method is required to re-define the global style defs. It is needed
|
|
136
|
-
* if any value in the DrawConfig changed in the meantime.
|
|
137
|
-
* @param drawConfig
|
|
138
|
-
*/
|
|
139
|
-
drawutilssvg.prototype.rebuildStyleDefs = function (drawConfig) {
|
|
140
|
-
// Which default styles to add? -> All from the DrawConfig.
|
|
141
|
-
// Compare with DrawConfig interface
|
|
142
|
-
var keys = {
|
|
143
|
-
"bezier": "CubicBezierCurve",
|
|
144
|
-
//"bezierPath": "BezierPath", // TODO: is this correct?
|
|
145
|
-
"polygon": "Polygon",
|
|
146
|
-
"triangle": "Triangle",
|
|
147
|
-
"ellipse": "Ellipse",
|
|
148
|
-
"ellipseSector": "EllipseSector",
|
|
149
|
-
"circle": "Circle",
|
|
150
|
-
"circleSector": "CircleSector",
|
|
151
|
-
"vertex": "Vertex",
|
|
152
|
-
"line": "Line",
|
|
153
|
-
"vector": "Vector",
|
|
154
|
-
"image": "Image",
|
|
155
|
-
"text": "Text"
|
|
156
|
-
};
|
|
157
|
-
// Question: why isn't this working if the svgNode is created dynamically? (nodeStyle.sheet is null)
|
|
158
|
-
var rules = [];
|
|
159
|
-
// console.log("drawConfig", drawConfig);
|
|
160
|
-
for (var k in keys) {
|
|
161
|
-
var className = keys[k];
|
|
162
|
-
var drawSettings = drawConfig[k];
|
|
163
|
-
if (drawSettings) {
|
|
164
|
-
rules.push(".".concat(className, " { fill : none; stroke: ").concat(drawSettings.color, "; stroke-width: ").concat(drawSettings.lineWidth, "px }"));
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
console.warn("Warning: your draw config is missing the key '".concat(k, "' which is required."));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (this.customStyleDefs) {
|
|
171
|
-
rules.push("\n/* Custom styles */\n");
|
|
172
|
-
this.customStyleDefs.forEach(function (value, key) {
|
|
173
|
-
rules.push(key + " { " + value + " }");
|
|
174
|
-
});
|
|
175
|
-
// this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + rules.join("\n");
|
|
176
|
-
}
|
|
177
|
-
this.nodeStyle.innerHTML = rules.join("\n");
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Adds the internal <defs> node.
|
|
181
|
-
*/
|
|
182
|
-
drawutilssvg.prototype.addDefsNode = function () {
|
|
183
|
-
this.nodeDefs = this.createSVGNode("defs");
|
|
184
|
-
// this.svgNode.appendChild(this.nodeDefs);
|
|
185
|
-
this.bufferedNodeDefs = this.createSVGNode("defs");
|
|
186
|
-
this.svgNode.appendChild(this.nodeDefs);
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* This is a simple way to include custom CSS class mappings to the style defs of the generated SVG.
|
|
190
|
-
*
|
|
191
|
-
* The mapping should be of the form
|
|
192
|
-
* [style-class] -> [style-def-string]
|
|
193
|
-
*
|
|
194
|
-
* Example:
|
|
195
|
-
* "rect.red" -> "fill: #ff0000; border: 1px solid red"
|
|
196
|
-
*
|
|
197
|
-
* @param {Map<string,string>} defs
|
|
198
|
-
*/
|
|
199
|
-
drawutilssvg.prototype.addCustomStyleDefs = function (defs) {
|
|
200
|
-
this.customStyleDefs = defs;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Retieve an old (cached) element.
|
|
204
|
-
* Only if both – key and nodeName – match, the element will be returned (null otherwise).
|
|
205
|
-
*
|
|
206
|
-
* @method findElement
|
|
207
|
-
* @private
|
|
208
|
-
* @memberof drawutilssvg
|
|
209
|
-
* @instance
|
|
210
|
-
* @param {UID} key - The key of the desired element (used when re-drawing).
|
|
211
|
-
* @param {string} nodeName - The expected node name.
|
|
212
|
-
*/
|
|
213
|
-
drawutilssvg.prototype.findElement = function (key, nodeName) {
|
|
214
|
-
if (!key) {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
var node = this.cache.get(key);
|
|
218
|
-
if (node && node.nodeName.toUpperCase() === nodeName.toUpperCase()) {
|
|
219
|
-
this.cache.delete(key);
|
|
220
|
-
return node;
|
|
221
|
-
}
|
|
222
|
-
return null;
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Create a new DOM node <svg> in the SVG namespace.
|
|
226
|
-
*
|
|
227
|
-
* @method createSVGNode
|
|
228
|
-
* @private
|
|
229
|
-
* @memberof drawutilssvg
|
|
230
|
-
* @instance
|
|
231
|
-
* @param {string} nodeName - The node name (tag-name).
|
|
232
|
-
* @return {SVGElement} A new element in the SVG namespace with the given node name.
|
|
233
|
-
*/
|
|
234
|
-
drawutilssvg.prototype.createSVGNode = function (nodeName) {
|
|
235
|
-
return document.createElementNS("http://www.w3.org/2000/svg", nodeName);
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* Make a new SVG node (or recycle an old one) with the given node name (circle, path, line, rect, ...).
|
|
239
|
-
*
|
|
240
|
-
* This function is used in draw cycles to re-use old DOM nodes (in hope to boost performance).
|
|
241
|
-
*
|
|
242
|
-
* @method makeNode
|
|
243
|
-
* @private
|
|
244
|
-
* @instance
|
|
245
|
-
* @memberof drawutilssvg
|
|
246
|
-
* @param {string} nodeName - The node name.
|
|
247
|
-
* @return {SVGElement} The new node, which is not yet added to any document.
|
|
248
|
-
*/
|
|
249
|
-
drawutilssvg.prototype.makeNode = function (nodeName) {
|
|
250
|
-
// Try to find node in current DOM cache.
|
|
251
|
-
// Unique node keys are strictly necessary.
|
|
252
|
-
// Try to recycle an old element from cache.
|
|
253
|
-
var node = this.findElement(this.curId, nodeName);
|
|
254
|
-
if (!node) {
|
|
255
|
-
// If no such old elements exists (key not found, tag name not matching),
|
|
256
|
-
// then create a new one.
|
|
257
|
-
node = this.createSVGNode(nodeName);
|
|
258
|
-
}
|
|
259
|
-
if (this.drawlibConfiguration.blendMode) {
|
|
260
|
-
var blendMode = node.style["mix-blend-mode"];
|
|
261
|
-
if (typeof blendMode === "function") {
|
|
262
|
-
blendMode(this.drawlibConfiguration.blendMode);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
// if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
|
|
269
|
-
// node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
|
|
270
|
-
// }
|
|
271
|
-
return node;
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* This is the final helper function for drawing and filling stuff and binding new
|
|
275
|
-
* nodes to the SVG document.
|
|
276
|
-
* It is not intended to be used from the outside.
|
|
277
|
-
*
|
|
278
|
-
* When in draw mode it draws the current shape.
|
|
279
|
-
* When in fill mode it fills the current shape.
|
|
280
|
-
*
|
|
281
|
-
* This function is usually only called internally.
|
|
282
|
-
*
|
|
283
|
-
* @method _bindFillDraw
|
|
284
|
-
* @private
|
|
285
|
-
* @instance
|
|
286
|
-
* @memberof drawutilssvg
|
|
287
|
-
* @param {SVGElement} node - The node to draw/fill and bind.
|
|
288
|
-
* @param {string} className - The class name(s) to use.
|
|
289
|
-
* @param {string} color - A stroke/fill color to use.
|
|
290
|
-
* @param {number=1} lineWidth - (optional) A line width to use for drawing (default is 1).
|
|
291
|
-
* @return {SVGElement} The node itself (for chaining).
|
|
292
|
-
*/
|
|
293
|
-
drawutilssvg.prototype._bindFillDraw = function (node, className, color, lineWidth, strokeOptions) {
|
|
294
|
-
this._configureNode(node, className, this.fillShapes, color, lineWidth, strokeOptions);
|
|
295
|
-
return this._bindNode(node, undefined);
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Bind this given node to a parent. If no parent is passed then the global
|
|
299
|
-
* node buffer will be used.
|
|
300
|
-
*
|
|
301
|
-
* @method _bindNode
|
|
302
|
-
* @private
|
|
303
|
-
* @instance
|
|
304
|
-
* @memberof drawutilssvg
|
|
305
|
-
* @param {SVGElement} node - The SVG node to bind.
|
|
306
|
-
* @param {SVGElement=} bindingParent - (optional) You may pass node other than the glober buffer node.
|
|
307
|
-
* @returns {SVGElement} The passed node itself.
|
|
308
|
-
*/
|
|
309
|
-
drawutilssvg.prototype._bindNode = function (node, bindingParent) {
|
|
310
|
-
if (!node.parentNode) {
|
|
311
|
-
// Attach to DOM only if not already attached
|
|
312
|
-
(bindingParent !== null && bindingParent !== void 0 ? bindingParent : this.bufferGNode).appendChild(node);
|
|
313
|
-
}
|
|
314
|
-
return node;
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* Add custom CSS class names and the globally defined CSS classname to the
|
|
318
|
-
* given node.
|
|
319
|
-
*
|
|
320
|
-
* @method addCSSClasses
|
|
321
|
-
* @private
|
|
322
|
-
* @instance
|
|
323
|
-
* @memberof drawutilssvg
|
|
324
|
-
* @param {SVGElement} node - The SVG node to bind.
|
|
325
|
-
* @param {string} className - The additional custom classname to add.
|
|
326
|
-
* @returns {void}
|
|
327
|
-
*/
|
|
328
|
-
drawutilssvg.prototype._addCSSClasses = function (node, className) {
|
|
329
|
-
if (this.curClassName) {
|
|
330
|
-
node.setAttribute("class", "".concat(className, " ").concat(this.curClassName));
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
node.setAttribute("class", className);
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
drawutilssvg.prototype._configureNode = function (node, className, fillMode, color, lineWidth, strokeOptions) {
|
|
337
|
-
this._addCSSClasses(node, className);
|
|
338
|
-
node.setAttribute("fill", fillMode && color ? color : "none");
|
|
339
|
-
node.setAttribute("stroke", fillMode ? "none" : color || "none");
|
|
340
|
-
node.setAttribute("stroke-width", "".concat(lineWidth || 1));
|
|
341
|
-
if (this.curId) {
|
|
342
|
-
node.setAttribute("id", "".concat(this.curId)); // Maybe React-style 'key' would be better?
|
|
343
|
-
}
|
|
344
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
345
|
-
return node;
|
|
346
|
-
};
|
|
347
|
-
/**
|
|
348
|
-
* Sets the size and view box of the document. Call this if canvas size changes.
|
|
349
|
-
*
|
|
350
|
-
* @method setSize
|
|
351
|
-
* @instance
|
|
352
|
-
* @memberof drawutilssvg
|
|
353
|
-
* @param {XYDimension} canvasSize - The new canvas size.
|
|
354
|
-
*/
|
|
355
|
-
drawutilssvg.prototype.setSize = function (canvasSize) {
|
|
356
|
-
this.canvasSize = canvasSize;
|
|
357
|
-
this.svgNode.setAttribute("viewBox", "0 0 ".concat(this.canvasSize.width, " ").concat(this.canvasSize.height));
|
|
358
|
-
this.svgNode.setAttribute("width", "".concat(this.canvasSize.width));
|
|
359
|
-
this.svgNode.setAttribute("height", "".concat(this.canvasSize.height));
|
|
360
|
-
};
|
|
361
|
-
/**
|
|
362
|
-
* Creates a 'shallow' (non deep) copy of this instance. This implies
|
|
363
|
-
* that under the hood the same gl context and gl program will be used.
|
|
364
|
-
*/
|
|
365
|
-
drawutilssvg.prototype.copyInstance = function (fillShapes) {
|
|
366
|
-
var copy = new drawutilssvg(this.svgNode, this.offset, this.scale, this.canvasSize, fillShapes, this.drawConfig, // null as any as DrawConfig, // no DrawConfig – this will work as long as `isSecondary===true`
|
|
367
|
-
true, // isSecondary
|
|
368
|
-
this.gNode, this.bufferGNode, this.nodeDefs, this.bufferedNodeDefs, this.nodeStyle);
|
|
369
|
-
return copy;
|
|
370
|
-
};
|
|
371
|
-
/**
|
|
372
|
-
* Set the current drawlib configuration.
|
|
373
|
-
*
|
|
374
|
-
* @name setConfiguration
|
|
375
|
-
* @method
|
|
376
|
-
* @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.
|
|
377
|
-
*/
|
|
378
|
-
drawutilssvg.prototype.setConfiguration = function (configuration) {
|
|
379
|
-
this.drawlibConfiguration = configuration;
|
|
380
|
-
};
|
|
381
|
-
/**
|
|
382
|
-
* This method shouled be called each time the currently drawn `Drawable` changes.
|
|
383
|
-
* It is used by some libraries for identifying elemente on re-renders.
|
|
384
|
-
*
|
|
385
|
-
* @name setCurrentId
|
|
386
|
-
* @method
|
|
387
|
-
* @param {UID|null} uid - A UID identifying the currently drawn element(s).
|
|
388
|
-
* @instance
|
|
389
|
-
* @memberof drawutilssvg
|
|
390
|
-
**/
|
|
391
|
-
drawutilssvg.prototype.setCurrentId = function (uid) {
|
|
392
|
-
this.curId = uid;
|
|
393
|
-
};
|
|
394
|
-
/**
|
|
395
|
-
* This method shouled be called each time the currently drawn `Drawable` changes.
|
|
396
|
-
* Determine the class name for further usage here.
|
|
397
|
-
*
|
|
398
|
-
* @name setCurrentClassName
|
|
399
|
-
* @method
|
|
400
|
-
* @param {string|null} className - A class name for further custom use cases.
|
|
401
|
-
* @instance
|
|
402
|
-
* @memberof drawutilssvg
|
|
403
|
-
**/
|
|
404
|
-
drawutilssvg.prototype.setCurrentClassName = function (className) {
|
|
405
|
-
this.curClassName = className;
|
|
406
|
-
};
|
|
407
|
-
/**
|
|
408
|
-
* Called before each draw cycle.
|
|
409
|
-
* This is required for compatibility with other draw classes in the library.
|
|
410
|
-
*
|
|
411
|
-
* @name beginDrawCycle
|
|
412
|
-
* @method
|
|
413
|
-
* @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).
|
|
414
|
-
* @instance
|
|
415
|
-
* @memberof drawutilssvg
|
|
416
|
-
**/
|
|
417
|
-
drawutilssvg.prototype.beginDrawCycle = function (renderTime) {
|
|
418
|
-
// Clear non-recycable elements from last draw cycle.
|
|
419
|
-
this.cache.clear();
|
|
420
|
-
// Clearing an SVG is equivalent to removing all its child elements.
|
|
421
|
-
for (var i = 0; i < this.bufferGNode.childNodes.length; i++) {
|
|
422
|
-
// Hide all nodes here. Don't throw them away.
|
|
423
|
-
// We can probably re-use them in the next draw cycle.
|
|
424
|
-
var child = this.bufferGNode.childNodes[i];
|
|
425
|
-
this.cache.set(child.getAttribute("id"), child);
|
|
426
|
-
}
|
|
427
|
-
this.removeAllChildNodes();
|
|
428
|
-
};
|
|
429
|
-
/**
|
|
430
|
-
* Called after each draw cycle.
|
|
431
|
-
*
|
|
432
|
-
* This is required for compatibility with other draw classes in the library (like drawgl).
|
|
433
|
-
*
|
|
434
|
-
* @name endDrawCycle
|
|
435
|
-
* @method
|
|
436
|
-
* @param {number} renderTime
|
|
437
|
-
* @instance
|
|
438
|
-
**/
|
|
439
|
-
drawutilssvg.prototype.endDrawCycle = function (renderTime) {
|
|
440
|
-
this.rebuildStyleDefs(this.drawConfig);
|
|
441
|
-
if (!this.isSecondary) {
|
|
442
|
-
// All elements are drawn into the buffer; they are NOT yet visible, not did the browser perform any
|
|
443
|
-
// layout updates.
|
|
444
|
-
// Replace the old <g>-node with the buffer node.
|
|
445
|
-
// https://stackoverflow.com/questions/27442464/how-to-update-a-svg-image-without-seeing-a-blinking
|
|
446
|
-
this.svgNode.replaceChild(this.bufferedNodeDefs, this.nodeDefs);
|
|
447
|
-
this.svgNode.replaceChild(this.bufferGNode, this.gNode);
|
|
448
|
-
}
|
|
449
|
-
var tmpGNode = this.gNode;
|
|
450
|
-
this.gNode = this.bufferGNode;
|
|
451
|
-
this.bufferGNode = tmpGNode;
|
|
452
|
-
var tmpDefsNode = this.nodeDefs;
|
|
453
|
-
this.nodeDefs = this.bufferedNodeDefs;
|
|
454
|
-
this.bufferedNodeDefs = tmpDefsNode;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* A private helper method to apply stroke options to the current
|
|
458
|
-
* context.
|
|
459
|
-
* @param {StrokeOptions=} strokeOptions -
|
|
460
|
-
*/
|
|
461
|
-
drawutilssvg.prototype.applyStrokeOpts = function (node, strokeOptions) {
|
|
462
|
-
var _this = this;
|
|
463
|
-
// Set line dash options?
|
|
464
|
-
if (strokeOptions &&
|
|
465
|
-
strokeOptions.dashArray &&
|
|
466
|
-
strokeOptions.dashArray.length > 0 &&
|
|
467
|
-
drawutilssvg.nodeSupportsLineDash(node.tagName)) {
|
|
468
|
-
node.setAttribute("stroke-dasharray", strokeOptions.dashArray
|
|
469
|
-
.map(function (dashArayElem) {
|
|
470
|
-
return dashArayElem * _this.scale.x;
|
|
471
|
-
})
|
|
472
|
-
.join(" "));
|
|
473
|
-
if (strokeOptions.dashOffset) {
|
|
474
|
-
node.setAttribute("stroke-dashoffset", "".concat(strokeOptions.dashOffset * this.scale.x));
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
// Set line join option?
|
|
478
|
-
if (strokeOptions && strokeOptions.lineJoin && drawutilssvg.nodeSupportsLineJoin(node.tagName)) {
|
|
479
|
-
node.setAttribute("stroke-linejoin", strokeOptions.lineJoin);
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
drawutilssvg.prototype._x = function (x) {
|
|
483
|
-
return this.offset.x + this.scale.x * x;
|
|
484
|
-
};
|
|
485
|
-
drawutilssvg.prototype._y = function (y) {
|
|
486
|
-
return this.offset.y + this.scale.y * y;
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* Draw the line between the given two points with the specified (CSS-) color.
|
|
490
|
-
*
|
|
491
|
-
* @method line
|
|
492
|
-
* @param {XYCoords} zA - The start point of the line.
|
|
493
|
-
* @param {XYCoords} zB - The end point of the line.
|
|
494
|
-
* @param {string} color - Any valid CSS color string.
|
|
495
|
-
* @param {number=1} lineWidth? - [optional] The line's width.
|
|
496
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
497
|
-
*
|
|
498
|
-
* @return {void}
|
|
499
|
-
* @instance
|
|
500
|
-
* @memberof drawutilssvg
|
|
501
|
-
**/
|
|
502
|
-
drawutilssvg.prototype.line = function (zA, zB, color, lineWidth, strokeOptions) {
|
|
503
|
-
// const line: SVGElement = this.makeNode("line");
|
|
504
|
-
// this.applyStrokeOpts(line, strokeOptions);
|
|
505
|
-
// line.setAttribute("x1", `${this._x(zA.x)}`);
|
|
506
|
-
// line.setAttribute("y1", `${this._y(zA.y)}`);
|
|
507
|
-
// line.setAttribute("x2", `${this._x(zB.x)}`);
|
|
508
|
-
// line.setAttribute("y2", `${this._y(zB.y)}`);
|
|
509
|
-
var line = this.makeLineNode(zA, zB, color, lineWidth, strokeOptions);
|
|
510
|
-
return this._bindFillDraw(line, "line", color, lineWidth || 1, strokeOptions);
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
514
|
-
*
|
|
515
|
-
* @method arrow
|
|
516
|
-
* @param {XYCoords} zA - The start point of the arrow-line.
|
|
517
|
-
* @param {XYCoords} zB - The end point of the arrow-line.
|
|
518
|
-
* @param {string} color - Any valid CSS color string.
|
|
519
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
520
|
-
* @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
|
|
521
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
522
|
-
*
|
|
523
|
-
* @return {void}
|
|
524
|
-
* @instance
|
|
525
|
-
* @memberof drawutilssvg
|
|
526
|
-
**/
|
|
527
|
-
drawutilssvg.prototype.arrow = function (zA, zB, color, lineWidth, headLength, strokeOptions) {
|
|
528
|
-
if (headLength === void 0) { headLength = 8; }
|
|
529
|
-
var group = this.makeNode("g");
|
|
530
|
-
var arrowHeadBasePosition = { x: 0, y: 0 };
|
|
531
|
-
// Just create the child nodes, don't bind them to the root node.
|
|
532
|
-
var arrowHead = this.makeArrowHeadNode(zA, zB, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
|
|
533
|
-
var line = this.makeLineNode(zA, arrowHeadBasePosition, color, lineWidth, strokeOptions);
|
|
534
|
-
group.appendChild(line);
|
|
535
|
-
group.appendChild(arrowHead);
|
|
536
|
-
this._addCSSClasses(group, "linear-arrow");
|
|
537
|
-
this._bindNode(group, undefined);
|
|
538
|
-
return group;
|
|
539
|
-
};
|
|
540
|
-
/**
|
|
541
|
-
* 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.
|
|
542
|
-
*
|
|
543
|
-
* @method cubicBezierArrow
|
|
544
|
-
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
545
|
-
* @param {XYCoords} endPoint - The end point the cubic Bézier curve.
|
|
546
|
-
* @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
|
|
547
|
-
* @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
|
|
548
|
-
* @param {string} color - The CSS color to draw the curve with.
|
|
549
|
-
* @param {number} lineWidth - (optional) The line width to use.
|
|
550
|
-
* @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
|
|
551
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
552
|
-
*
|
|
553
|
-
* @return {void}
|
|
554
|
-
* @instance
|
|
555
|
-
* @memberof DrawLib
|
|
556
|
-
*/
|
|
557
|
-
drawutilssvg.prototype.cubicBezierArrow = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, headLength, strokeOptions) {
|
|
558
|
-
if (headLength === void 0) { headLength = 8; }
|
|
559
|
-
var group = this.makeNode("g");
|
|
560
|
-
// Just create the child nodes, don't bind them to the root node.
|
|
561
|
-
var arrowHeadBasePosition = new Vertex_1.Vertex(0, 0);
|
|
562
|
-
var arrowHead = this.makeArrowHeadNode(endControlPoint, endPoint, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
|
|
563
|
-
var diff = arrowHeadBasePosition.difference(endPoint);
|
|
564
|
-
var bezier = this.makeCubicBezierNode(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);
|
|
565
|
-
group.appendChild(bezier);
|
|
566
|
-
group.appendChild(arrowHead);
|
|
567
|
-
this._addCSSClasses(group, "cubicbezier-arrow");
|
|
568
|
-
this._bindNode(group, undefined);
|
|
569
|
-
return group;
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
572
|
-
* Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
|
|
573
|
-
*
|
|
574
|
-
* @method arrow
|
|
575
|
-
* @param {XYCoords} zA - The start point of the arrow-line.
|
|
576
|
-
* @param {XYCoords} zB - The end point of the arrow-line.
|
|
577
|
-
* @param {string} color - Any valid CSS color string.
|
|
578
|
-
* @param {number=1} lineWidth - (optional) The line width to use; default is 1.
|
|
579
|
-
* @param {number=8} headLength - (optional) The length of the arrow head (default is 8 pixels).
|
|
580
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
581
|
-
*
|
|
582
|
-
* @return {void}
|
|
583
|
-
* @instance
|
|
584
|
-
* @memberof DrawLib
|
|
585
|
-
**/
|
|
586
|
-
drawutilssvg.prototype.arrowHead = function (zA, zB, color, lineWidth, headLength, strokeOptions) {
|
|
587
|
-
if (headLength === void 0) { headLength = 8; }
|
|
588
|
-
var node = this.makeArrowHeadNode(zA, zB, color, lineWidth, headLength, strokeOptions);
|
|
589
|
-
return this._bindFillDraw(node, "arrowhead", color, lineWidth || 1, strokeOptions);
|
|
590
|
-
};
|
|
591
|
-
/**
|
|
592
|
-
* Draw an image at the given position with the given size.<br>
|
|
593
|
-
* <br>
|
|
594
|
-
* 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.
|
|
595
|
-
*
|
|
596
|
-
* @method image
|
|
597
|
-
* @param {Image} image - The image object to draw.
|
|
598
|
-
* @param {XYCoords} position - The position to draw the the upper left corner at.
|
|
599
|
-
* @param {XYCoords} size - The x/y-size to draw the image with.
|
|
600
|
-
* @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
|
|
601
|
-
* @return {void}
|
|
602
|
-
* @instance
|
|
603
|
-
* @memberof drawutilssvg
|
|
604
|
-
**/
|
|
605
|
-
drawutilssvg.prototype.image = function (image, position, size, alpha) {
|
|
606
|
-
var _this = this;
|
|
607
|
-
if (alpha === void 0) { alpha = 1.0; }
|
|
608
|
-
var node = this.makeNode("image");
|
|
609
|
-
// We need to re-adjust the image if it was not yet fully loaded before.
|
|
610
|
-
var setImageSize = function (image) {
|
|
611
|
-
if (image.naturalWidth) {
|
|
612
|
-
var ratioX = size.x / image.naturalWidth;
|
|
613
|
-
var ratioY = size.y / image.naturalHeight;
|
|
614
|
-
node.setAttribute("width", "".concat(image.naturalWidth * _this.scale.x));
|
|
615
|
-
node.setAttribute("height", "".concat(image.naturalHeight * _this.scale.y));
|
|
616
|
-
node.setAttribute("display", null); // Dislay when loaded
|
|
617
|
-
// if (alpha) {
|
|
618
|
-
node.setAttribute("opacity", "".concat(alpha));
|
|
619
|
-
// }
|
|
620
|
-
node.setAttribute("transform", "translate(".concat(_this._x(position.x), " ").concat(_this._y(position.y), ") scale(").concat(ratioX, " ").concat(ratioY, ")"));
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
image.addEventListener("load", function (event) {
|
|
624
|
-
setImageSize(image);
|
|
625
|
-
});
|
|
626
|
-
// Safari has a transform-origin bug.
|
|
627
|
-
// Use x=0, y=0 and translate/scale instead (see above)
|
|
628
|
-
node.setAttribute("x", "".concat(0));
|
|
629
|
-
node.setAttribute("y", "".concat(0));
|
|
630
|
-
node.setAttribute("display", "none"); // Hide before loaded
|
|
631
|
-
setImageSize(image);
|
|
632
|
-
node.setAttribute("href", image.src);
|
|
633
|
-
return this._bindFillDraw(node, "image", null, null);
|
|
634
|
-
};
|
|
635
|
-
/**
|
|
636
|
-
* Draw an image at the given position with the given size.<br>
|
|
637
|
-
* <br>
|
|
638
|
-
* 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.
|
|
639
|
-
*
|
|
640
|
-
* @method texturedPoly
|
|
641
|
-
* @param {Image} textureImage - The image object to draw.
|
|
642
|
-
* @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
|
|
643
|
-
* @param {Polygon} polygon - The polygon to use as clip path.
|
|
644
|
-
* @param {XYCoords} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
|
|
645
|
-
* @param {number} rotation - The rotation to use for the polygon (and for the texture).
|
|
646
|
-
* @return {void}
|
|
647
|
-
* @instance
|
|
648
|
-
* @memberof drawutilssvg
|
|
649
|
-
**/
|
|
650
|
-
drawutilssvg.prototype.texturedPoly = function (textureImage, textureSize, polygon, polygonPosition, rotation) {
|
|
651
|
-
// const basePolygonBounds: Bounds = polygon.getBounds();
|
|
652
|
-
var rotatedScalingOrigin = new Vertex_1.Vertex(textureSize.min).clone().rotate(rotation, polygonPosition);
|
|
653
|
-
// const rotationCenter = polygonPosition.clone().add(rotatedScalingOrigin.difference(textureSize.min).inv());
|
|
654
|
-
// Create something like this
|
|
655
|
-
// ...
|
|
656
|
-
// <defs>
|
|
657
|
-
// <clipPath id="shape">
|
|
658
|
-
// <path fill="none" d="..."/>
|
|
659
|
-
// </clipPath>
|
|
660
|
-
// </defs>
|
|
661
|
-
// ...
|
|
662
|
-
// <g clip-path="url(#shape)">
|
|
663
|
-
// <g transform="scale(...)">
|
|
664
|
-
// <image width="643" height="643" transform="rotate(...)" xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/beagle400.jpg" >
|
|
665
|
-
// </g>
|
|
666
|
-
// </g>
|
|
667
|
-
// </image>
|
|
668
|
-
// ...
|
|
669
|
-
var clipPathNode = this.makeNode("clipPath");
|
|
670
|
-
var clipPathId = "clippath_".concat(UIDGenerator_1.UIDGenerator.next()); // TODO: use a better UUID generator here?
|
|
671
|
-
clipPathNode.setAttribute("id", clipPathId);
|
|
672
|
-
var gNode = this.makeNode("g");
|
|
673
|
-
var imageNode = this.makeNode("image");
|
|
674
|
-
imageNode.setAttribute("x", "".concat(this._x(rotatedScalingOrigin.x)));
|
|
675
|
-
imageNode.setAttribute("y", "".concat(this._y(rotatedScalingOrigin.y)));
|
|
676
|
-
imageNode.setAttribute("width", "".concat(textureSize.width));
|
|
677
|
-
imageNode.setAttribute("height", "".concat(textureSize.height));
|
|
678
|
-
imageNode.setAttribute("href", textureImage.src);
|
|
679
|
-
// imageNode.setAttribute("opacity", "0.5");
|
|
680
|
-
// SVG rotations in degrees
|
|
681
|
-
imageNode.setAttribute("transform", "rotate(".concat(rotation * RAD_TO_DEG, ", ").concat(this._x(rotatedScalingOrigin.x), ", ").concat(this._y(rotatedScalingOrigin.y), ")"));
|
|
682
|
-
var pathNode = this.makeNode("path");
|
|
683
|
-
var pathData = [];
|
|
684
|
-
if (polygon.vertices.length > 0) {
|
|
685
|
-
var self_1 = this;
|
|
686
|
-
pathData.push("M", "".concat(this._x(polygon.vertices[0].x)), "".concat(this._y(polygon.vertices[0].y)));
|
|
687
|
-
for (var i = 1; i < polygon.vertices.length; i++) {
|
|
688
|
-
pathData.push("L", "".concat(this._x(polygon.vertices[i].x)), "".concat(this._y(polygon.vertices[i].y)));
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
pathNode.setAttribute("d", pathData.join(" "));
|
|
692
|
-
clipPathNode.appendChild(pathNode);
|
|
693
|
-
this.bufferedNodeDefs.appendChild(clipPathNode);
|
|
694
|
-
gNode.appendChild(imageNode);
|
|
695
|
-
gNode.setAttribute("transform-origin", "".concat(this._x(rotatedScalingOrigin.x), " ").concat(this._y(rotatedScalingOrigin.y)));
|
|
696
|
-
gNode.setAttribute("transform", "scale(".concat(this.scale.x, ", ").concat(this.scale.y, ")"));
|
|
697
|
-
var clipNode = this.makeNode("g");
|
|
698
|
-
clipNode.appendChild(gNode);
|
|
699
|
-
clipNode.setAttribute("clip-path", "url(#".concat(clipPathId, ")"));
|
|
700
|
-
// TODO: check if the image class is correct here or if we should use a 'clippedImage' class here
|
|
701
|
-
this._bindFillDraw(clipNode, "image", null, null); // No color, no lineWidth
|
|
702
|
-
return clipNode;
|
|
703
|
-
};
|
|
704
|
-
/**
|
|
705
|
-
* Draw the given (cubic) bézier curve.
|
|
706
|
-
*
|
|
707
|
-
* @method cubicBezier
|
|
708
|
-
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
709
|
-
* @param {XYCoords} endPoint - The end point the cubic Bézier curve.
|
|
710
|
-
* @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
|
|
711
|
-
* @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
|
|
712
|
-
* @param {string} color - The CSS color to draw the curve with.
|
|
713
|
-
* @param {number} lineWidth - (optional) The line width to use.
|
|
714
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
715
|
-
*
|
|
716
|
-
* @return {void}
|
|
717
|
-
* @instance
|
|
718
|
-
* @memberof drawutilssvg
|
|
719
|
-
*/
|
|
720
|
-
drawutilssvg.prototype.cubicBezier = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
|
|
721
|
-
var node = this.makeCubicBezierNode(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions);
|
|
722
|
-
return this._bindNode(node, undefined);
|
|
723
|
-
};
|
|
724
|
-
/**
|
|
725
|
-
* Draw the given (cubic) Bézier path.
|
|
726
|
-
*
|
|
727
|
-
* The given path must be an array with n*3+1 vertices, where n is the number of
|
|
728
|
-
* curves in the path:
|
|
729
|
-
* <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
|
|
730
|
-
*
|
|
731
|
-
* @method cubicBezierPath
|
|
732
|
-
* @param {XYCoords[]} path - The cubic bezier path as described above.
|
|
733
|
-
* @param {string} color - The CSS colot to draw the path with.
|
|
734
|
-
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
735
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
736
|
-
* @param {boolean} isOpen - (optional) Set to tur if the path should not be closed.
|
|
737
|
-
* @return {void}
|
|
738
|
-
* @instance
|
|
739
|
-
* @memberof drawutilssvg
|
|
740
|
-
*/
|
|
741
|
-
drawutilssvg.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions, isOpen) {
|
|
742
|
-
var node = this.makeNode("path");
|
|
743
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
744
|
-
if (!path || path.length == 0) {
|
|
745
|
-
return node;
|
|
746
|
-
}
|
|
747
|
-
// Draw curve
|
|
748
|
-
var d = ["M", this._x(path[0].x), this._y(path[0].y)];
|
|
749
|
-
// Draw curve path
|
|
750
|
-
var endPoint;
|
|
751
|
-
var startControlPoint;
|
|
752
|
-
var endControlPoint;
|
|
753
|
-
for (var i = 1; i < path.length; i += 3) {
|
|
754
|
-
startControlPoint = path[i];
|
|
755
|
-
endControlPoint = path[i + 1];
|
|
756
|
-
endPoint = path[i + 2];
|
|
757
|
-
d.push("C", this._x(startControlPoint.x), this._y(startControlPoint.y), this._x(endControlPoint.x), this._y(endControlPoint.y), this._x(endPoint.x), this._y(endPoint.y));
|
|
758
|
-
}
|
|
759
|
-
if (!isOpen) {
|
|
760
|
-
d.push("Z");
|
|
761
|
-
}
|
|
762
|
-
node.setAttribute("d", d.join(" "));
|
|
763
|
-
return this._bindFillDraw(node, "cubicBezierPath", color, lineWidth || 1);
|
|
764
|
-
};
|
|
765
|
-
/**
|
|
766
|
-
* Draw the given handle and handle point (used to draw interactive Bézier curves).
|
|
767
|
-
*
|
|
768
|
-
* The colors for this are fixed and cannot be specified.
|
|
769
|
-
*
|
|
770
|
-
* @method handle
|
|
771
|
-
* @param {Vertex} startPoint - The start of the handle.
|
|
772
|
-
* @param {Vertex} endPoint - The end point of the handle.
|
|
773
|
-
* @return {void}
|
|
774
|
-
* @instance
|
|
775
|
-
* @memberof drawutilssvg
|
|
776
|
-
*/
|
|
777
|
-
drawutilssvg.prototype.handle = function (startPoint, endPoint) {
|
|
778
|
-
// TODO: redefine methods like these into an abstract class?
|
|
779
|
-
this.point(startPoint, "rgb(0,32,192)");
|
|
780
|
-
this.square(endPoint, 5, "rgba(0,128,192,0.5)");
|
|
781
|
-
};
|
|
782
|
-
/**
|
|
783
|
-
* Draw a handle line (with a light grey).
|
|
784
|
-
*
|
|
785
|
-
* @method handleLine
|
|
786
|
-
* @param {XYCoords} startPoint - The start point to draw the handle at.
|
|
787
|
-
* @param {XYCoords} endPoint - The end point to draw the handle at.
|
|
788
|
-
* @return {void}
|
|
789
|
-
* @instance
|
|
790
|
-
* @memberof drawutilssvg
|
|
791
|
-
*/
|
|
792
|
-
drawutilssvg.prototype.handleLine = function (startPoint, endPoint) {
|
|
793
|
-
this.line(startPoint, endPoint, "rgb(128,128,128,0.5)");
|
|
794
|
-
};
|
|
795
|
-
/**
|
|
796
|
-
* Draw a 1x1 dot with the specified (CSS-) color.
|
|
797
|
-
*
|
|
798
|
-
* @method dot
|
|
799
|
-
* @param {XYCoords} p - The position to draw the dot at.
|
|
800
|
-
* @param {string} color - The CSS color to draw the dot with.
|
|
801
|
-
* @return {void}
|
|
802
|
-
* @instance
|
|
803
|
-
* @memberof drawutilssvg
|
|
804
|
-
*/
|
|
805
|
-
drawutilssvg.prototype.dot = function (p, color) {
|
|
806
|
-
var node = this.makeNode("line");
|
|
807
|
-
node.setAttribute("x1", "".concat(this._x(p.x)));
|
|
808
|
-
node.setAttribute("y1", "".concat(this._y(p.y)));
|
|
809
|
-
node.setAttribute("x2", "".concat(this._x(p.x)));
|
|
810
|
-
node.setAttribute("y2", "".concat(this._y(p.y)));
|
|
811
|
-
return this._bindFillDraw(node, "dot", color, 1);
|
|
812
|
-
};
|
|
813
|
-
/**
|
|
814
|
-
* Draw the given point with the specified (CSS-) color and radius 3.
|
|
815
|
-
*
|
|
816
|
-
* @method point
|
|
817
|
-
* @param {XYCoords} p - The position to draw the point at.
|
|
818
|
-
* @param {string} color - The CSS color to draw the point with.
|
|
819
|
-
* @return {void}
|
|
820
|
-
* @instance
|
|
821
|
-
* @memberof drawutilssvg
|
|
822
|
-
*/
|
|
823
|
-
drawutilssvg.prototype.point = function (p, color) {
|
|
824
|
-
var radius = 3;
|
|
825
|
-
var node = this.makeNode("circle");
|
|
826
|
-
node.setAttribute("cx", "".concat(this._x(p.x)));
|
|
827
|
-
node.setAttribute("cy", "".concat(this._y(p.y)));
|
|
828
|
-
node.setAttribute("r", "".concat(radius));
|
|
829
|
-
return this._bindFillDraw(node, "point", color, 1);
|
|
830
|
-
};
|
|
831
|
-
/**
|
|
832
|
-
* Draw a circle with the specified (CSS-) color and radius.<br>
|
|
833
|
-
* <br>
|
|
834
|
-
* Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
|
|
835
|
-
*
|
|
836
|
-
* @method circle
|
|
837
|
-
* @param {XYCoords} center - The center of the circle.
|
|
838
|
-
* @param {number} radius - The radius of the circle.
|
|
839
|
-
* @param {string} color - The CSS color to draw the circle with.
|
|
840
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
841
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
842
|
-
*
|
|
843
|
-
* @return {void}
|
|
844
|
-
* @instance
|
|
845
|
-
* @memberof drawutilssvg
|
|
846
|
-
*/
|
|
847
|
-
drawutilssvg.prototype.circle = function (center, radius, color, lineWidth, strokeOptions) {
|
|
848
|
-
// Todo: draw ellipse when scalex!=scaley
|
|
849
|
-
var node = this.makeNode("circle");
|
|
850
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
851
|
-
node.setAttribute("cx", "".concat(this._x(center.x)));
|
|
852
|
-
node.setAttribute("cy", "".concat(this._y(center.y)));
|
|
853
|
-
node.setAttribute("r", "".concat(radius * this.scale.x)); // y?
|
|
854
|
-
return this._bindFillDraw(node, "circle", color, lineWidth || 1);
|
|
855
|
-
};
|
|
856
|
-
/**
|
|
857
|
-
* Draw a circular arc (section of a circle) with the given CSS color.
|
|
858
|
-
*
|
|
859
|
-
* @method circleArc
|
|
860
|
-
* @param {XYCoords} center - The center of the circle.
|
|
861
|
-
* @param {number} radius - The radius of the circle.
|
|
862
|
-
* @param {number} startAngle - The angle to start at.
|
|
863
|
-
* @param {number} endAngle - The angle to end at.
|
|
864
|
-
* @param {string} color - The CSS color to draw the circle with.
|
|
865
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
866
|
-
*
|
|
867
|
-
* @return {void}
|
|
868
|
-
* @instance
|
|
869
|
-
* @memberof drawutilssvg
|
|
870
|
-
*/
|
|
871
|
-
drawutilssvg.prototype.circleArc = function (center, radius, startAngle, endAngle, color, lineWidth, strokeOptions) {
|
|
872
|
-
var node = this.makeNode("path");
|
|
873
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
874
|
-
var arcData = CircleSector_1.CircleSector.circleSectorUtils.describeSVGArc(this._x(center.x), this._y(center.y), radius * this.scale.x, // y?
|
|
875
|
-
startAngle, endAngle);
|
|
876
|
-
node.setAttribute("d", arcData.join(" "));
|
|
877
|
-
return this._bindFillDraw(node, "circleArc", color, lineWidth || 1);
|
|
878
|
-
};
|
|
879
|
-
/**
|
|
880
|
-
* Draw an ellipse with the specified (CSS-) color and thw two radii.
|
|
881
|
-
*
|
|
882
|
-
* @method ellipse
|
|
883
|
-
* @param {XYCoords} center - The center of the ellipse.
|
|
884
|
-
* @param {number} radiusX - The radius of the ellipse.
|
|
885
|
-
* @param {number} radiusY - The radius of the ellipse.
|
|
886
|
-
* @param {string} color - The CSS color to draw the ellipse with.
|
|
887
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
888
|
-
* @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
|
|
889
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
890
|
-
*
|
|
891
|
-
* @return {void}
|
|
892
|
-
* @instance
|
|
893
|
-
* @memberof drawutilssvg
|
|
894
|
-
*/
|
|
895
|
-
drawutilssvg.prototype.ellipse = function (center, radiusX, radiusY, color, lineWidth, rotation, strokeOptions) {
|
|
896
|
-
if (typeof rotation === "undefined") {
|
|
897
|
-
rotation = 0.0;
|
|
898
|
-
}
|
|
899
|
-
var node = this.makeNode("ellipse");
|
|
900
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
901
|
-
node.setAttribute("cx", "".concat(this._x(center.x)));
|
|
902
|
-
node.setAttribute("cy", "".concat(this._y(center.y)));
|
|
903
|
-
node.setAttribute("rx", "".concat(radiusX * this.scale.x));
|
|
904
|
-
node.setAttribute("ry", "".concat(radiusY * this.scale.y));
|
|
905
|
-
// node.setAttribute( 'style', `transform: rotate(${rotation} ${center.x} ${center.y})` );
|
|
906
|
-
node.setAttribute("transform", "rotate(".concat((rotation * 180) / Math.PI, " ").concat(this._x(center.x), " ").concat(this._y(center.y), ")"));
|
|
907
|
-
return this._bindFillDraw(node, "ellipse", color, lineWidth || 1);
|
|
908
|
-
};
|
|
909
|
-
/**
|
|
910
|
-
* Draw square at the given center, size and with the specified (CSS-) color.<br>
|
|
911
|
-
* <br>
|
|
912
|
-
* Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.
|
|
913
|
-
*
|
|
914
|
-
* @method square
|
|
915
|
-
* @param {XYCoords} center - The center of the square.
|
|
916
|
-
* @param {number} size - The size of the square.
|
|
917
|
-
* @param {string} color - The CSS color to draw the square with.
|
|
918
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
919
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
920
|
-
*
|
|
921
|
-
* @return {SVGElement}
|
|
922
|
-
* @instance
|
|
923
|
-
* @memberof drawutilssvg
|
|
924
|
-
*/
|
|
925
|
-
drawutilssvg.prototype.square = function (center, size, color, lineWidth, strokeOptions) {
|
|
926
|
-
var node = this.makeNode("rectangle");
|
|
927
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
928
|
-
node.setAttribute("x", "".concat(this._x(center.x - size / 2.0)));
|
|
929
|
-
node.setAttribute("y", "".concat(this._y(center.y - size / 2.0)));
|
|
930
|
-
node.setAttribute("width", "".concat(size * this.scale.x));
|
|
931
|
-
node.setAttribute("height", "".concat(size * this.scale.y));
|
|
932
|
-
return this._bindFillDraw(node, "square", color, lineWidth || 1);
|
|
933
|
-
};
|
|
934
|
-
/**
|
|
935
|
-
* Draw a rectangle.
|
|
936
|
-
*
|
|
937
|
-
* @param {XYCoords} position - The upper left corner of the rectangle.
|
|
938
|
-
* @param {number} width - The width of the rectangle.
|
|
939
|
-
* @param {number} height - The height of the rectangle.
|
|
940
|
-
* @param {string} color - The color to use.
|
|
941
|
-
* @param {number=1} lineWidth - (optional) The line with to use (default is 1).
|
|
942
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
943
|
-
*
|
|
944
|
-
* @return {SVGElement}
|
|
945
|
-
* @instance
|
|
946
|
-
* @memberof drawutilssvg
|
|
947
|
-
**/
|
|
948
|
-
drawutilssvg.prototype.rect = function (position, width, height, color, lineWidth, strokeOptions) {
|
|
949
|
-
var node = this.makeNode("rect");
|
|
950
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
951
|
-
node.setAttribute("x", "".concat(this._x(position.x)));
|
|
952
|
-
node.setAttribute("y", "".concat(this._y(position.y)));
|
|
953
|
-
node.setAttribute("width", "".concat(width * this.scale.x));
|
|
954
|
-
node.setAttribute("height", "".concat(height * this.scale.y));
|
|
955
|
-
return this._bindFillDraw(node, "rect", color, lineWidth || 1);
|
|
956
|
-
};
|
|
957
|
-
/**
|
|
958
|
-
* Draw a grid of horizontal and vertical lines with the given (CSS-) color.
|
|
959
|
-
*
|
|
960
|
-
* @method grid
|
|
961
|
-
* @param {XYCoords} center - The center of the grid.
|
|
962
|
-
* @param {number} width - The total width of the grid (width/2 each to the left and to the right).
|
|
963
|
-
* @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
|
|
964
|
-
* @param {number} sizeX - The horizontal grid size.
|
|
965
|
-
* @param {number} sizeY - The vertical grid size.
|
|
966
|
-
* @param {string} color - The CSS color to draw the grid with.
|
|
967
|
-
* @return {void}
|
|
968
|
-
* @instance
|
|
969
|
-
* @memberof drawutilssvg
|
|
970
|
-
*/
|
|
971
|
-
drawutilssvg.prototype.grid = function (center, width, height, sizeX, sizeY, color) {
|
|
972
|
-
// console.log("grid");
|
|
973
|
-
// const node: SVGElement = this.makeNode("pattern");
|
|
974
|
-
// var patternId = "pattern_id_" + Math.floor(Math.random() * 65365);
|
|
975
|
-
// node.setAttribute("id", patternId);
|
|
976
|
-
// node.setAttribute("viewBox", `0,0,${sizeX},${sizeY}`);
|
|
977
|
-
// node.setAttribute("width", `${sizeX}`);
|
|
978
|
-
// node.setAttribute("height", `${sizeX}`);
|
|
979
|
-
// var pattern: SVGElement = this.makeNode("path");
|
|
980
|
-
// const d: SVGPathParams = [];
|
|
981
|
-
// d.push("M", sizeX / 2.0, 0);
|
|
982
|
-
// d.push("L", sizeX / 2.0, sizeY);
|
|
983
|
-
// d.push("M", 0, sizeY / 2.0);
|
|
984
|
-
// d.push("L", sizeX, sizeY / 2.0);
|
|
985
|
-
// node.setAttribute("d", d.join(" "));
|
|
986
|
-
// this.bufferedNodeDefs.append(pattern);
|
|
987
|
-
// const fillNode: SVGElement = this.makeNode("rect");
|
|
988
|
-
// // For some strange reason SVG rotation transforms use degrees instead of radians
|
|
989
|
-
// // Note that the background does not scale with the zoom level (always covers full element)
|
|
990
|
-
// fillNode.setAttribute("x", "0");
|
|
991
|
-
// fillNode.setAttribute("y", "0");
|
|
992
|
-
// fillNode.setAttribute("width", `${this.canvasSize.width}`);
|
|
993
|
-
// fillNode.setAttribute("height", `${this.canvasSize.height}`);
|
|
994
|
-
// fillNode.setAttribute("fill", `url(#${patternId})`);
|
|
995
|
-
// return this._bindFillDraw(fillNode, "grid", "red", 1);
|
|
996
|
-
var node = this.makeNode("path");
|
|
997
|
-
var d = [];
|
|
998
|
-
var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;
|
|
999
|
-
var yMax = height / 2;
|
|
1000
|
-
for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
|
|
1001
|
-
d.push("M", this._x(center.x + x), this._y(center.y + yMin));
|
|
1002
|
-
d.push("L", this._x(center.x + x), this._y(center.y + yMax));
|
|
1003
|
-
}
|
|
1004
|
-
var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX;
|
|
1005
|
-
var xMax = width / 2;
|
|
1006
|
-
for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
|
|
1007
|
-
d.push("M", this._x(center.x + xMin), this._y(center.y + y));
|
|
1008
|
-
d.push("L", this._x(center.x + xMax), this._y(center.y + y));
|
|
1009
|
-
}
|
|
1010
|
-
node.setAttribute("d", d.join(" "));
|
|
1011
|
-
return this._bindFillDraw(node, "grid", color, 1);
|
|
1012
|
-
};
|
|
1013
|
-
/**
|
|
1014
|
-
* Draw a raster of crosshairs in the given grid.<br>
|
|
1015
|
-
*
|
|
1016
|
-
* This works analogue to the grid() function
|
|
1017
|
-
*
|
|
1018
|
-
* @method raster
|
|
1019
|
-
* @param {XYCoords} center - The center of the raster.
|
|
1020
|
-
* @param {number} width - The total width of the raster (width/2 each to the left and to the right).
|
|
1021
|
-
* @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
|
|
1022
|
-
* @param {number} sizeX - The horizontal raster size.
|
|
1023
|
-
* @param {number} sizeY - The vertical raster size.
|
|
1024
|
-
* @param {string} color - The CSS color to draw the raster with.
|
|
1025
|
-
* @return {void}
|
|
1026
|
-
* @instance
|
|
1027
|
-
* @memberof drawutilssvg
|
|
1028
|
-
*/
|
|
1029
|
-
drawutilssvg.prototype.raster = function (center, width, height, sizeX, sizeY, color) {
|
|
1030
|
-
var node = this.makeNode("path");
|
|
1031
|
-
var d = [];
|
|
1032
|
-
for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
|
|
1033
|
-
for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
|
|
1034
|
-
// Draw a crosshair
|
|
1035
|
-
d.push("M", this._x(center.x + x) - 4, this._y(center.y + y));
|
|
1036
|
-
d.push("L", this._x(center.x + x) + 4, this._y(center.y + y));
|
|
1037
|
-
d.push("M", this._x(center.x + x), this._y(center.y + y) - 4);
|
|
1038
|
-
d.push("L", this._x(center.x + x), this._y(center.y + y) + 4);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
node.setAttribute("d", d.join(" "));
|
|
1042
|
-
return this._bindFillDraw(node, "raster", color, 1);
|
|
1043
|
-
};
|
|
1044
|
-
/**
|
|
1045
|
-
* Draw a diamond handle (square rotated by 45°) with the given CSS color.
|
|
1046
|
-
*
|
|
1047
|
-
* It is an inherent featur of the handle functions that the drawn elements are not scaled and not
|
|
1048
|
-
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
1049
|
-
* as even shaped diamonds.
|
|
1050
|
-
*
|
|
1051
|
-
* @method diamondHandle
|
|
1052
|
-
* @param {XYCoords} center - The center of the diamond.
|
|
1053
|
-
* @param {number} size - The x/y-size of the diamond.
|
|
1054
|
-
* @param {string} color - The CSS color to draw the diamond with.
|
|
1055
|
-
* @return {void}
|
|
1056
|
-
* @instance
|
|
1057
|
-
* @memberof drawutilssvg
|
|
1058
|
-
*/
|
|
1059
|
-
drawutilssvg.prototype.diamondHandle = function (center, size, color) {
|
|
1060
|
-
var node = this.makeNode("path");
|
|
1061
|
-
var d = [
|
|
1062
|
-
"M",
|
|
1063
|
-
this._x(center.x) - size / 2.0,
|
|
1064
|
-
this._y(center.y),
|
|
1065
|
-
"L",
|
|
1066
|
-
this._x(center.x),
|
|
1067
|
-
this._y(center.y) - size / 2.0,
|
|
1068
|
-
"L",
|
|
1069
|
-
this._x(center.x) + size / 2.0,
|
|
1070
|
-
this._y(center.y),
|
|
1071
|
-
"L",
|
|
1072
|
-
this._x(center.x),
|
|
1073
|
-
this._y(center.y) + size / 2.0,
|
|
1074
|
-
"Z"
|
|
1075
|
-
];
|
|
1076
|
-
node.setAttribute("d", d.join(" "));
|
|
1077
|
-
return this._bindFillDraw(node, "diamondHandle", color, 1);
|
|
1078
|
-
};
|
|
1079
|
-
/**
|
|
1080
|
-
* Draw a square handle with the given CSS color.<br>
|
|
1081
|
-
* <br>
|
|
1082
|
-
* It is an inherent featur of the handle functions that the drawn elements are not scaled and not
|
|
1083
|
-
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
1084
|
-
* as even shaped squares.
|
|
1085
|
-
*
|
|
1086
|
-
* @method squareHandle
|
|
1087
|
-
* @param {XYCoords} center - The center of the square.
|
|
1088
|
-
* @param {XYCoords} size - The x/y-size of the square.
|
|
1089
|
-
* @param {string} color - The CSS color to draw the square with.
|
|
1090
|
-
* @return {void}
|
|
1091
|
-
* @instance
|
|
1092
|
-
* @memberof drawutilssvg
|
|
1093
|
-
*/
|
|
1094
|
-
drawutilssvg.prototype.squareHandle = function (center, size, color) {
|
|
1095
|
-
var node = this.makeNode("rect");
|
|
1096
|
-
node.setAttribute("x", "".concat(this._x(center.x) - size / 2.0));
|
|
1097
|
-
node.setAttribute("y", "".concat(this._y(center.y) - size / 2.0));
|
|
1098
|
-
node.setAttribute("width", "".concat(size));
|
|
1099
|
-
node.setAttribute("height", "".concat(size));
|
|
1100
|
-
return this._bindFillDraw(node, "squareHandle", color, 1);
|
|
1101
|
-
};
|
|
1102
|
-
/**
|
|
1103
|
-
* Draw a circle handle with the given CSS color.<br>
|
|
1104
|
-
* <br>
|
|
1105
|
-
* It is an inherent featur of the handle functions that the drawn elements are not scaled and not
|
|
1106
|
-
* distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
|
|
1107
|
-
* as even shaped circles.
|
|
1108
|
-
*
|
|
1109
|
-
* @method circleHandle
|
|
1110
|
-
* @param {XYCoords} center - The center of the circle.
|
|
1111
|
-
* @param {number} radius - The radius of the circle.
|
|
1112
|
-
* @param {string} color - The CSS color to draw the circle with.
|
|
1113
|
-
* @return {void}
|
|
1114
|
-
* @instance
|
|
1115
|
-
* @memberof drawutilssvg
|
|
1116
|
-
*/
|
|
1117
|
-
drawutilssvg.prototype.circleHandle = function (center, radius, color) {
|
|
1118
|
-
radius = radius || 3;
|
|
1119
|
-
var node = this.makeNode("circle");
|
|
1120
|
-
node.setAttribute("cx", "".concat(this._x(center.x)));
|
|
1121
|
-
node.setAttribute("cy", "".concat(this._y(center.y)));
|
|
1122
|
-
node.setAttribute("r", "".concat(radius));
|
|
1123
|
-
return this._bindFillDraw(node, "circleHandle", color, 1);
|
|
1124
|
-
};
|
|
1125
|
-
/**
|
|
1126
|
-
* Draw a crosshair with given radius and color at the given position.<br>
|
|
1127
|
-
* <br>
|
|
1128
|
-
* Note that the crosshair radius will not be affected by scaling.
|
|
1129
|
-
*
|
|
1130
|
-
* @method crosshair
|
|
1131
|
-
* @param {XYCoords} center - The center of the crosshair.
|
|
1132
|
-
* @param {number} radius - The radius of the crosshair.
|
|
1133
|
-
* @param {string} color - The CSS color to draw the crosshair with.
|
|
1134
|
-
* @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
|
|
1135
|
-
* @return {void}
|
|
1136
|
-
* @instance
|
|
1137
|
-
* @memberof drawutilssvg
|
|
1138
|
-
*/
|
|
1139
|
-
drawutilssvg.prototype.crosshair = function (center, radius, color, lineWidth) {
|
|
1140
|
-
var node = this.makeNode("path");
|
|
1141
|
-
var d = [
|
|
1142
|
-
"M",
|
|
1143
|
-
this._x(center.x) - radius,
|
|
1144
|
-
this._y(center.y),
|
|
1145
|
-
"L",
|
|
1146
|
-
this._x(center.x) + radius,
|
|
1147
|
-
this._y(center.y),
|
|
1148
|
-
"M",
|
|
1149
|
-
this._x(center.x),
|
|
1150
|
-
this._y(center.y) - radius,
|
|
1151
|
-
"L",
|
|
1152
|
-
this._x(center.x),
|
|
1153
|
-
this._y(center.y) + radius
|
|
1154
|
-
];
|
|
1155
|
-
node.setAttribute("d", d.join(" "));
|
|
1156
|
-
return this._bindFillDraw(node, "crosshair", color, lineWidth || 0.5);
|
|
1157
|
-
};
|
|
1158
|
-
/**
|
|
1159
|
-
* Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
|
|
1160
|
-
* <br>
|
|
1161
|
-
* Note that the x's radius will not be affected by scaling.
|
|
1162
|
-
*
|
|
1163
|
-
* @method crosshair
|
|
1164
|
-
* @param {XYCoords} center - The center of the crosshair.
|
|
1165
|
-
* @param {number} radius - The radius of the crosshair.
|
|
1166
|
-
* @param {string} color - The CSS color to draw the crosshair with.
|
|
1167
|
-
* @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
|
|
1168
|
-
* @return {void}
|
|
1169
|
-
* @instance
|
|
1170
|
-
* @memberof drawutils
|
|
1171
|
-
*/
|
|
1172
|
-
drawutilssvg.prototype.cross = function (center, radius, color, lineWidth) {
|
|
1173
|
-
var node = this.makeNode("path");
|
|
1174
|
-
var d = [
|
|
1175
|
-
"M",
|
|
1176
|
-
this._x(center.x) - radius,
|
|
1177
|
-
this._y(center.y) - radius,
|
|
1178
|
-
"L",
|
|
1179
|
-
this._x(center.x) + radius,
|
|
1180
|
-
this._y(center.y) + radius,
|
|
1181
|
-
"M",
|
|
1182
|
-
this._x(center.x) - radius,
|
|
1183
|
-
this._y(center.y) + radius,
|
|
1184
|
-
"L",
|
|
1185
|
-
this._x(center.x) + radius,
|
|
1186
|
-
this._y(center.y) - radius
|
|
1187
|
-
];
|
|
1188
|
-
node.setAttribute("d", d.join(" "));
|
|
1189
|
-
return this._bindFillDraw(node, "cross", color, lineWidth || 1.0);
|
|
1190
|
-
};
|
|
1191
|
-
/**
|
|
1192
|
-
* Draw a polygon.
|
|
1193
|
-
*
|
|
1194
|
-
* @method polygon
|
|
1195
|
-
* @param {Polygon} polygon - The polygon to draw.
|
|
1196
|
-
* @param {string} color - The CSS color to draw the polygon with.
|
|
1197
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
1198
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
1199
|
-
* @return {void}
|
|
1200
|
-
* @instance
|
|
1201
|
-
* @memberof drawutilssvg
|
|
1202
|
-
*/
|
|
1203
|
-
drawutilssvg.prototype.polygon = function (polygon, color, lineWidth, strokeOptions) {
|
|
1204
|
-
return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
|
|
1205
|
-
};
|
|
1206
|
-
/**
|
|
1207
|
-
* Draw a polygon line (alternative function to the polygon).
|
|
1208
|
-
*
|
|
1209
|
-
* @method polyline
|
|
1210
|
-
* @param {XYCoords[]} vertices - The polygon vertices to draw.
|
|
1211
|
-
* @param {boolan} isOpen - If true the polyline will not be closed at its end.
|
|
1212
|
-
* @param {string} color - The CSS color to draw the polygon with.
|
|
1213
|
-
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
1214
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
1215
|
-
*
|
|
1216
|
-
* @return {void}
|
|
1217
|
-
* @instance
|
|
1218
|
-
* @memberof drawutilssvg
|
|
1219
|
-
*/
|
|
1220
|
-
drawutilssvg.prototype.polyline = function (vertices, isOpen, color, lineWidth, strokeOptions) {
|
|
1221
|
-
var node = this.makeNode("path");
|
|
1222
|
-
this.applyStrokeOpts(node, strokeOptions);
|
|
1223
|
-
if (vertices.length == 0) {
|
|
1224
|
-
return node;
|
|
1225
|
-
}
|
|
1226
|
-
// Draw curve
|
|
1227
|
-
var d = ["M", this._x(vertices[0].x), this._y(vertices[0].y)];
|
|
1228
|
-
var n = vertices.length;
|
|
1229
|
-
for (var i = 1; i < n; i++) {
|
|
1230
|
-
d.push("L", this._x(vertices[i].x), this._y(vertices[i].y));
|
|
1231
|
-
}
|
|
1232
|
-
if (!isOpen)
|
|
1233
|
-
d.push("Z");
|
|
1234
|
-
node.setAttribute("d", d.join(" "));
|
|
1235
|
-
return this._bindFillDraw(node, "polygon", color, lineWidth || 1);
|
|
1236
|
-
};
|
|
1237
|
-
/**
|
|
1238
|
-
* Draw a text at the given relative position.
|
|
1239
|
-
*
|
|
1240
|
-
* @method text
|
|
1241
|
-
* @param {string} text - The text to draw.
|
|
1242
|
-
* @param {number} x - The x-position to draw the text at.
|
|
1243
|
-
* @param {number} y - The y-position to draw the text at.
|
|
1244
|
-
* @param {string=} options.color - The Color to use.
|
|
1245
|
-
* @param {string=} options.fontFamily - The font family to use.
|
|
1246
|
-
* @param {number=} options.fontSize - The font size (in pixels) to use.
|
|
1247
|
-
* @param {FontStyle=} options.fontStyle - The font style to use.
|
|
1248
|
-
* @param {FontWeight=} options.fontWeight - The font weight to use.
|
|
1249
|
-
* @param {number=} options.lineHeight - The line height (in pixels) to use.
|
|
1250
|
-
* @param {number=} options.rotation - The (optional) rotation in radians.
|
|
1251
|
-
* @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"`.
|
|
1252
|
-
* @return {void}
|
|
1253
|
-
* @instance
|
|
1254
|
-
* @memberof drawutils
|
|
1255
|
-
*/
|
|
1256
|
-
drawutilssvg.prototype.text = function (text, x, y, options) {
|
|
1257
|
-
var _a, _b, _c;
|
|
1258
|
-
options = options || {};
|
|
1259
|
-
var color = options.color || "black";
|
|
1260
|
-
var lineHeight = ((_b = (_a = options.lineHeight) !== null && _a !== void 0 ? _a : options.fontSize) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
|
|
1261
|
-
// https://www.w3.org/TR/SVG/text.html#TextAnchorProperty
|
|
1262
|
-
// start | middle | end
|
|
1263
|
-
var textAlign = options.textAlign === "left" || options.textAlign === "start"
|
|
1264
|
-
? "start"
|
|
1265
|
-
: options.textAlign === "center"
|
|
1266
|
-
? "middle"
|
|
1267
|
-
: options.textAlign === "right" || options.textAlign === "end"
|
|
1268
|
-
? "end"
|
|
1269
|
-
: "start";
|
|
1270
|
-
var transformOrigin = "".concat(this._x(x), "px ").concat(this._y(y), "px");
|
|
1271
|
-
var translate = "translate(".concat(this._x(x), " ").concat(this._y(y) + lineHeight / 2, ")");
|
|
1272
|
-
// Safari has a transform-origin/rotation bug.
|
|
1273
|
-
// It's essential to use rotate(r,x,y) here. "rotate(r)"" with transform-origin(x,y) won't do the job.
|
|
1274
|
-
// And rotate and translate cannot be used is combination on a text object.
|
|
1275
|
-
// So wrap the text inside a <g>, translate the <g>, and rotate the text inside.
|
|
1276
|
-
var rotate = options.rotation ? "rotate(".concat(options.rotation * RAD_TO_DEG, " 0 0)") : "";
|
|
1277
|
-
var node = this.makeNode("g");
|
|
1278
|
-
var curId = this.curId;
|
|
1279
|
-
this.curId = curId + "_text";
|
|
1280
|
-
var textNode = this.makeNode("text");
|
|
1281
|
-
node.appendChild(textNode);
|
|
1282
|
-
textNode.setAttribute("font-family", (_c = options.fontFamily) !== null && _c !== void 0 ? _c : ""); // May be undefined
|
|
1283
|
-
textNode.setAttribute("font-size", options.fontSize ? "".concat(options.fontSize * this.scale.x) : "");
|
|
1284
|
-
textNode.setAttribute("font-style", options.fontStyle ? "".concat(options.fontStyle) : "");
|
|
1285
|
-
textNode.setAttribute("font-weight", options.fontWeight ? "".concat(options.fontWeight) : "");
|
|
1286
|
-
textNode.setAttribute("text-anchor", textAlign);
|
|
1287
|
-
textNode.setAttribute("transform-origin", "0 0");
|
|
1288
|
-
textNode.setAttribute("transform", rotate);
|
|
1289
|
-
node.setAttribute("transform-origin", transformOrigin);
|
|
1290
|
-
node.setAttribute("transform", translate);
|
|
1291
|
-
textNode.innerHTML = text;
|
|
1292
|
-
// Restore old ID
|
|
1293
|
-
this.curId = curId;
|
|
1294
|
-
return this._bindFillDraw(node, "text", color, 1);
|
|
1295
|
-
};
|
|
1296
|
-
/**
|
|
1297
|
-
* Draw a non-scaling text label at the given position.
|
|
1298
|
-
*
|
|
1299
|
-
* @method label
|
|
1300
|
-
* @param {string} text - The text to draw.
|
|
1301
|
-
* @param {number} x - The x-position to draw the text at.
|
|
1302
|
-
* @param {number} y - The y-position to draw the text at.
|
|
1303
|
-
* @param {number=} rotation - The (optional) rotation in radians.
|
|
1304
|
-
* @param {string="black"} color - The color to use (default is black).
|
|
1305
|
-
* @return {void}
|
|
1306
|
-
* @instance
|
|
1307
|
-
* @memberof drawutilssvg
|
|
1308
|
-
*/
|
|
1309
|
-
drawutilssvg.prototype.label = function (text, x, y, rotation, color) {
|
|
1310
|
-
var node = this.makeNode("text");
|
|
1311
|
-
// For some strange reason SVG rotation transforms use degrees instead of radians
|
|
1312
|
-
node.setAttribute("transform", "translate(".concat(x, ",").concat(y, "), rotate(").concat(((rotation || 0) / Math.PI) * 180, ")"));
|
|
1313
|
-
node.setAttribute("font-family", "Arial");
|
|
1314
|
-
node.setAttribute("font-size", "9pt");
|
|
1315
|
-
node.setAttribute("font-style", "normal");
|
|
1316
|
-
node.setAttribute("font-weight", "lighter");
|
|
1317
|
-
node.innerHTML = text;
|
|
1318
|
-
return this._bindFillDraw(node, "label", color || "black", null);
|
|
1319
|
-
};
|
|
1320
|
-
/**
|
|
1321
|
-
* Draw an SVG-like path given by the specified path data.
|
|
1322
|
-
*
|
|
1323
|
-
* @method path
|
|
1324
|
-
* @param {SVGPathData} pathData - An array of path commands and params.
|
|
1325
|
-
* @param {string=null} color - (optional) The color to draw this path with (default is null).
|
|
1326
|
-
* @param {number=1} lineWidth - (optional) the line width to use (default is 1).
|
|
1327
|
-
* @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.
|
|
1328
|
-
* @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
|
|
1329
|
-
* @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
|
|
1330
|
-
*
|
|
1331
|
-
* @instance
|
|
1332
|
-
* @memberof drawutils
|
|
1333
|
-
* @return {R} An instance representing the drawn path.
|
|
1334
|
-
*/
|
|
1335
|
-
drawutilssvg.prototype.path = function (pathData, color, lineWidth, options) {
|
|
1336
|
-
var node = this.makeNode("path");
|
|
1337
|
-
this.applyStrokeOpts(node, options);
|
|
1338
|
-
// Transform the path: in-place (fast) or copy (slower)
|
|
1339
|
-
var d = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);
|
|
1340
|
-
drawutilssvg.transformPathData(d, this.offset, this.scale);
|
|
1341
|
-
node.setAttribute("d", d.join(" "));
|
|
1342
|
-
return this._bindFillDraw(node, "path", color, lineWidth);
|
|
1343
|
-
};
|
|
1344
|
-
/**
|
|
1345
|
-
* Due to gl compatibility there is a generic 'clear' function required
|
|
1346
|
-
* to avoid accessing the context object itself directly.
|
|
1347
|
-
*
|
|
1348
|
-
* This function just fills the whole canvas with a single color.
|
|
1349
|
-
*
|
|
1350
|
-
* @param {string} color - The color to clear with.
|
|
1351
|
-
* @return {void}
|
|
1352
|
-
* @instance
|
|
1353
|
-
* @memberof drawutilssvg
|
|
1354
|
-
**/
|
|
1355
|
-
drawutilssvg.prototype.clear = function (color) {
|
|
1356
|
-
// If this isn't the primary handler then do not remove anything here.
|
|
1357
|
-
// The primary handler will do that (no double work).
|
|
1358
|
-
if (this.isSecondary) {
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
// Add a covering rect with the given background color
|
|
1362
|
-
this.curId = "background";
|
|
1363
|
-
this.curClassName = null; // undefined;
|
|
1364
|
-
var node = this.makeNode("rect");
|
|
1365
|
-
// For some strange reason SVG rotation transforms use degrees instead of radians
|
|
1366
|
-
// Note that the background does not scale with the zoom level (always covers full element)
|
|
1367
|
-
node.setAttribute("x", "0");
|
|
1368
|
-
node.setAttribute("y", "0");
|
|
1369
|
-
node.setAttribute("width", "".concat(this.canvasSize.width));
|
|
1370
|
-
node.setAttribute("height", "".concat(this.canvasSize.height));
|
|
1371
|
-
// Bind this special element into the document
|
|
1372
|
-
this._bindFillDraw(node, this.curId, null, null);
|
|
1373
|
-
node.setAttribute("fill", typeof color === "undefined" ? "none" : color);
|
|
1374
|
-
// Clear the current ID again
|
|
1375
|
-
this.curId = null; // undefined;
|
|
1376
|
-
};
|
|
1377
|
-
/**
|
|
1378
|
-
* A private helper function to clear all SVG nodes from the >g> node.
|
|
1379
|
-
*
|
|
1380
|
-
* @private
|
|
1381
|
-
*/
|
|
1382
|
-
drawutilssvg.prototype.removeAllChildNodes = function () {
|
|
1383
|
-
while (this.bufferGNode.lastChild) {
|
|
1384
|
-
this.bufferGNode.removeChild(this.bufferGNode.lastChild);
|
|
1385
|
-
}
|
|
1386
|
-
while (this.bufferedNodeDefs.lastChild) {
|
|
1387
|
-
this.bufferedNodeDefs.removeChild(this.bufferedNodeDefs.lastChild);
|
|
1388
|
-
}
|
|
1389
|
-
};
|
|
1390
|
-
/**
|
|
1391
|
-
* Create a new and empty `SVGElement` <svg> in the svg-namespace.
|
|
1392
|
-
*
|
|
1393
|
-
* @name createSvg
|
|
1394
|
-
* @static
|
|
1395
|
-
* @memberof drawutilssvg
|
|
1396
|
-
* @return SVGElement
|
|
1397
|
-
*/
|
|
1398
|
-
drawutilssvg.createSvg = function () {
|
|
1399
|
-
return document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1400
|
-
};
|
|
1401
|
-
/**
|
|
1402
|
-
* Create a copy of the given path data. As path data only consists of strings and numbers,
|
|
1403
|
-
* the copy will be shallow by definition.
|
|
1404
|
-
*
|
|
1405
|
-
* @name copyPathData
|
|
1406
|
-
* @static
|
|
1407
|
-
* @memberof drawutilssvg
|
|
1408
|
-
*/
|
|
1409
|
-
drawutilssvg.copyPathData = function (data) {
|
|
1410
|
-
var copy = new Array(data.length);
|
|
1411
|
-
for (var i = 0, n = data.length; i < n; i++) {
|
|
1412
|
-
copy[i] = data[i];
|
|
1413
|
-
}
|
|
1414
|
-
return copy;
|
|
1415
|
-
};
|
|
1416
|
-
/**
|
|
1417
|
-
* Transform the given path data (translate and scale. rotating is not intended here).
|
|
1418
|
-
*
|
|
1419
|
-
* @name transformPathData
|
|
1420
|
-
* @static
|
|
1421
|
-
* @memberof drawutilssvg
|
|
1422
|
-
* @param {SVGPathParams} data - The data to transform.
|
|
1423
|
-
* @param {XYCoords} offset - The translation offset (neutral is x=0, y=0).
|
|
1424
|
-
* @param {XYCoords} scale - The scale factors (neutral is x=1, y=1).
|
|
1425
|
-
*/
|
|
1426
|
-
drawutilssvg.transformPathData = function (data, offset, scale) {
|
|
1427
|
-
// Scale and translate {x,y}
|
|
1428
|
-
var _stx = function (index) {
|
|
1429
|
-
data[index] = offset.x + scale.x * Number(data[index]);
|
|
1430
|
-
};
|
|
1431
|
-
var _sty = function (index) {
|
|
1432
|
-
data[index] = offset.y + scale.y * Number(data[index]);
|
|
1433
|
-
};
|
|
1434
|
-
// scale only {x,y}
|
|
1435
|
-
var _sx = function (index) {
|
|
1436
|
-
data[index] = scale.x * Number(data[index]);
|
|
1437
|
-
};
|
|
1438
|
-
var _sy = function (index) {
|
|
1439
|
-
data[index] = scale.y * Number(data[index]);
|
|
1440
|
-
};
|
|
1441
|
-
var i = 0;
|
|
1442
|
-
var lastPoint = { x: NaN, y: NaN };
|
|
1443
|
-
// "save last point"
|
|
1444
|
-
var _slp = function (index) {
|
|
1445
|
-
lastPoint.x = Number(data[index]);
|
|
1446
|
-
lastPoint.y = Number(data[index + 1]);
|
|
1447
|
-
};
|
|
1448
|
-
while (i < data.length) {
|
|
1449
|
-
var cmd = data[i];
|
|
1450
|
-
switch (cmd) {
|
|
1451
|
-
case "M":
|
|
1452
|
-
// MoveTo: M|m x y
|
|
1453
|
-
case "L":
|
|
1454
|
-
// LineTo L|l x y
|
|
1455
|
-
case "T":
|
|
1456
|
-
// Shorthand/smooth quadratic Bézier curveto: T|t x y
|
|
1457
|
-
_stx(i + 1);
|
|
1458
|
-
_sty(i + 2);
|
|
1459
|
-
_slp(i + 1);
|
|
1460
|
-
i += 3;
|
|
1461
|
-
break;
|
|
1462
|
-
case "m":
|
|
1463
|
-
// MoveTo: M|m x y
|
|
1464
|
-
case "l":
|
|
1465
|
-
// LineTo L|l x y
|
|
1466
|
-
case "t":
|
|
1467
|
-
// Shorthand/smooth quadratic Bézier curveto: T|t x y
|
|
1468
|
-
_sx(i + 1);
|
|
1469
|
-
_sy(i + 2);
|
|
1470
|
-
_slp(i + 1);
|
|
1471
|
-
i += 3;
|
|
1472
|
-
break;
|
|
1473
|
-
case "H":
|
|
1474
|
-
// HorizontalLineTo: H|h x
|
|
1475
|
-
_stx(i + 1);
|
|
1476
|
-
lastPoint.x = Number(data[i + 1]);
|
|
1477
|
-
i += 2;
|
|
1478
|
-
break;
|
|
1479
|
-
case "h":
|
|
1480
|
-
// HorizontalLineTo: H|h x
|
|
1481
|
-
_sx(i + 1);
|
|
1482
|
-
lastPoint.x = Number(data[i + 1]);
|
|
1483
|
-
i += 2;
|
|
1484
|
-
break;
|
|
1485
|
-
case "V":
|
|
1486
|
-
// VerticalLineTo: V|v y
|
|
1487
|
-
_sty(i + 1);
|
|
1488
|
-
lastPoint.y = Number(data[i + 1]);
|
|
1489
|
-
i += 2;
|
|
1490
|
-
break;
|
|
1491
|
-
case "v":
|
|
1492
|
-
// VerticalLineTo: V|v y
|
|
1493
|
-
_sy(i + 1);
|
|
1494
|
-
lastPoint.y = Number(data[i + 1]);
|
|
1495
|
-
i += 2;
|
|
1496
|
-
break;
|
|
1497
|
-
case "C":
|
|
1498
|
-
// CurveTo: C|c x1 y1 x2 y2 x y
|
|
1499
|
-
_stx(i + 1);
|
|
1500
|
-
_sty(i + 2);
|
|
1501
|
-
_stx(i + 3);
|
|
1502
|
-
_sty(i + 4);
|
|
1503
|
-
_stx(i + 5);
|
|
1504
|
-
_sty(i + 6);
|
|
1505
|
-
_slp(i + 5);
|
|
1506
|
-
i += 7;
|
|
1507
|
-
break;
|
|
1508
|
-
case "c":
|
|
1509
|
-
// CurveTo: C|c x1 y1 x2 y2 x y
|
|
1510
|
-
_sx(i + 1);
|
|
1511
|
-
_sy(i + 2);
|
|
1512
|
-
_sx(i + 3);
|
|
1513
|
-
_sy(i + 4);
|
|
1514
|
-
_sx(i + 5);
|
|
1515
|
-
_sy(i + 6);
|
|
1516
|
-
_slp(i + 5);
|
|
1517
|
-
i += 7;
|
|
1518
|
-
break;
|
|
1519
|
-
case "S":
|
|
1520
|
-
case "Q":
|
|
1521
|
-
// Shorthand-/SmoothCurveTo: S|s x2 y2 x y
|
|
1522
|
-
// QuadraticCurveTo: Q|q x1 y1 x y
|
|
1523
|
-
_stx(i + 1);
|
|
1524
|
-
_sty(i + 2);
|
|
1525
|
-
_stx(i + 3);
|
|
1526
|
-
_sty(i + 4);
|
|
1527
|
-
_slp(i + 3);
|
|
1528
|
-
i += 5;
|
|
1529
|
-
break;
|
|
1530
|
-
case "s":
|
|
1531
|
-
case "q":
|
|
1532
|
-
// Shorthand-/SmoothCurveTo: S|s x2 y2 x y
|
|
1533
|
-
// QuadraticCurveTo: Q|q x1 y1 x y
|
|
1534
|
-
_sx(i + 1);
|
|
1535
|
-
_sy(i + 2);
|
|
1536
|
-
_sx(i + 3);
|
|
1537
|
-
_sy(i + 4);
|
|
1538
|
-
_slp(i + 3);
|
|
1539
|
-
i += 5;
|
|
1540
|
-
break;
|
|
1541
|
-
case "A":
|
|
1542
|
-
// EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y
|
|
1543
|
-
// Uniform scale: just scale
|
|
1544
|
-
// NOTE: here is something TODO
|
|
1545
|
-
// * if scalex!=scaleY this won't work
|
|
1546
|
-
// * Arcs have to be converted to Bézier curves here in that case
|
|
1547
|
-
_sx(i + 1);
|
|
1548
|
-
_sy(i + 2);
|
|
1549
|
-
_stx(i + 6);
|
|
1550
|
-
_sty(i + 7);
|
|
1551
|
-
_slp(i + 6);
|
|
1552
|
-
// Update the arc flag when x _or_ y scale is negative
|
|
1553
|
-
if ((scale.x < 0 && scale.y >= 0) || (scale.x >= 0 && scale.y < 0)) {
|
|
1554
|
-
data[i + 5] = data[i + 5] ? 0 : 1;
|
|
1555
|
-
}
|
|
1556
|
-
i += 8;
|
|
1557
|
-
break;
|
|
1558
|
-
case "a":
|
|
1559
|
-
// EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y
|
|
1560
|
-
_sx(i + 1);
|
|
1561
|
-
_sy(i + 2);
|
|
1562
|
-
_sx(i + 6);
|
|
1563
|
-
_sy(i + 7);
|
|
1564
|
-
_slp(i + 6);
|
|
1565
|
-
i += 8;
|
|
1566
|
-
break;
|
|
1567
|
-
case "z":
|
|
1568
|
-
case "Z":
|
|
1569
|
-
// ClosePath: Z|z (no arguments)
|
|
1570
|
-
// lastPoint.x = firstPoint.x;
|
|
1571
|
-
// lastPoint.y = firstPoint.y;
|
|
1572
|
-
i++;
|
|
1573
|
-
break;
|
|
1574
|
-
// Safepoint: continue reading token by token until something is recognized again
|
|
1575
|
-
default:
|
|
1576
|
-
i++;
|
|
1577
|
-
}
|
|
1578
|
-
} // END while
|
|
1579
|
-
}; // END transformPathData
|
|
1580
|
-
drawutilssvg.nodeSupportsLineDash = function (nodeName) {
|
|
1581
|
-
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
1582
|
-
};
|
|
1583
|
-
drawutilssvg.nodeSupportsLineJoin = function (nodeName) {
|
|
1584
|
-
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
1585
|
-
};
|
|
1586
|
-
/**
|
|
1587
|
-
* Creates a basic <line> node with start and end coordinates. The created node will not
|
|
1588
|
-
* be bound to any root node.
|
|
1589
|
-
*
|
|
1590
|
-
* @private
|
|
1591
|
-
* @method makeLineNode
|
|
1592
|
-
* @param {XYCoords} zA - The line's start position.
|
|
1593
|
-
* @param {XYCoords} zB - The line's start position.
|
|
1594
|
-
* @param {string} color - The CSS color to draw the point with.
|
|
1595
|
-
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
1596
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
|
|
1597
|
-
* @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
|
|
1598
|
-
* @return {SVGLineElement}
|
|
1599
|
-
* @instance
|
|
1600
|
-
* @memberof drawutilssvg
|
|
1601
|
-
*/
|
|
1602
|
-
drawutilssvg.prototype.makeLineNode = function (zA, zB, color, lineWidth, strokeOptions, classNameOverride) {
|
|
1603
|
-
var line = this.makeNode("line");
|
|
1604
|
-
line.setAttribute("x1", "".concat(this._x(zA.x)));
|
|
1605
|
-
line.setAttribute("y1", "".concat(this._y(zA.y)));
|
|
1606
|
-
line.setAttribute("x2", "".concat(this._x(zB.x)));
|
|
1607
|
-
line.setAttribute("y2", "".concat(this._y(zB.y)));
|
|
1608
|
-
this._configureNode(line, classNameOverride !== null && classNameOverride !== void 0 ? classNameOverride : "line", this.fillShapes, color, lineWidth || 1, strokeOptions);
|
|
1609
|
-
return line;
|
|
1610
|
-
};
|
|
1611
|
-
/**
|
|
1612
|
-
* Creates a basic <path> node with given path string data. The created node will not
|
|
1613
|
-
* be bound to any root node.
|
|
1614
|
-
*
|
|
1615
|
-
* @private
|
|
1616
|
-
* @method makePathNode
|
|
1617
|
-
* @param {string} pathString - The path data (must be a valid path data string).
|
|
1618
|
-
* @param {string} color - The CSS color to draw the point with.
|
|
1619
|
-
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
1620
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
|
|
1621
|
-
* @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
|
|
1622
|
-
* @return {SVGPathElement}
|
|
1623
|
-
* @instance
|
|
1624
|
-
* @memberof drawutilssvg
|
|
1625
|
-
*/
|
|
1626
|
-
drawutilssvg.prototype.makePathNode = function (pathString, color, lineWidth, strokeOptions, classNameOverride) {
|
|
1627
|
-
var path = this.makeNode("path");
|
|
1628
|
-
path.setAttribute("d", pathString);
|
|
1629
|
-
this._configureNode(path, classNameOverride !== null && classNameOverride !== void 0 ? classNameOverride : "path", this.fillShapes, color, lineWidth || 1, strokeOptions);
|
|
1630
|
-
return path;
|
|
1631
|
-
};
|
|
1632
|
-
/**
|
|
1633
|
-
* Creates a basic arrow head node (<path> node) at the end of the given line coordinates. The created node will not
|
|
1634
|
-
* be bound to any root node.
|
|
1635
|
-
*
|
|
1636
|
-
* @private
|
|
1637
|
-
* @method makeArrowHeadNode
|
|
1638
|
-
* @param {string} pathString - The path data (must be a valid path data string).
|
|
1639
|
-
* @param {string} color - The CSS color to draw the point with.
|
|
1640
|
-
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
1641
|
-
* @param {number=8} headLength - (optional) The length of the arrow head; if none is specified then the head will be 8 absolute units long.
|
|
1642
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
|
|
1643
|
-
* @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.
|
|
1644
|
-
* @return {SVGPathElement}
|
|
1645
|
-
* @instance
|
|
1646
|
-
* @memberof drawutilssvg
|
|
1647
|
-
*/
|
|
1648
|
-
drawutilssvg.prototype.makeArrowHeadNode = function (zA, zB, color, lineWidth, headLength, strokeOptions, arrowHeadBasePositionBuffer) {
|
|
1649
|
-
if (headLength === void 0) { headLength = 8; }
|
|
1650
|
-
var vertices = Vector_1.Vector.utils.buildArrowHead(zA, zB, headLength, this.scale.x, this.scale.y);
|
|
1651
|
-
var d = ["M", this.offset.x + vertices[0].x, this.offset.y + vertices[0].y];
|
|
1652
|
-
if (arrowHeadBasePositionBuffer) {
|
|
1653
|
-
arrowHeadBasePositionBuffer.x = vertices[0].x / this.scale.x;
|
|
1654
|
-
arrowHeadBasePositionBuffer.y = vertices[0].y / this.scale.y;
|
|
1655
|
-
}
|
|
1656
|
-
for (var i = 1; i <= vertices.length; i++) {
|
|
1657
|
-
d.push("L");
|
|
1658
|
-
// Note: only use offset here (the vertices are already scaled)
|
|
1659
|
-
d.push(this.offset.x + vertices[i % vertices.length].x);
|
|
1660
|
-
d.push(this.offset.y + vertices[i % vertices.length].y);
|
|
1661
|
-
}
|
|
1662
|
-
var node = this.makePathNode(d.join(" "), color, lineWidth, strokeOptions, "arrowhead");
|
|
1663
|
-
return node;
|
|
1664
|
-
};
|
|
1665
|
-
/**
|
|
1666
|
-
* Creates a basic cubic Bézier path node (<path> node) with the given cubic Bézier data. The created node will not
|
|
1667
|
-
* be bound to any root node.
|
|
1668
|
-
*
|
|
1669
|
-
* @private
|
|
1670
|
-
* @method makeCubicBezierNode
|
|
1671
|
-
* @param {XYCoords} startPoint - The start point of the cubic Bézier curve
|
|
1672
|
-
* @param {XYCoords} endPoint - The end point the cubic Bézier curve.
|
|
1673
|
-
* @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
|
|
1674
|
-
* @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
|
|
1675
|
-
* @param {string} color - The CSS color to draw the point with.
|
|
1676
|
-
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
1677
|
-
* @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
|
|
1678
|
-
* @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
|
|
1679
|
-
* @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.
|
|
1680
|
-
* @return {SVGPathElement}
|
|
1681
|
-
* @instance
|
|
1682
|
-
* @memberof drawutilssvg
|
|
1683
|
-
*/
|
|
1684
|
-
drawutilssvg.prototype.makeCubicBezierNode = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
|
|
1685
|
-
if (startPoint instanceof CubicBezierCurve_1.CubicBezierCurve) {
|
|
1686
|
-
return this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);
|
|
1687
|
-
}
|
|
1688
|
-
// Draw curve
|
|
1689
|
-
var d = [
|
|
1690
|
-
"M",
|
|
1691
|
-
this._x(startPoint.x),
|
|
1692
|
-
this._y(startPoint.y),
|
|
1693
|
-
"C",
|
|
1694
|
-
this._x(startControlPoint.x),
|
|
1695
|
-
this._y(startControlPoint.y),
|
|
1696
|
-
this._x(endControlPoint.x),
|
|
1697
|
-
this._y(endControlPoint.y),
|
|
1698
|
-
this._x(endPoint.x),
|
|
1699
|
-
this._y(endPoint.y)
|
|
1700
|
-
];
|
|
1701
|
-
var node = this.makePathNode(d.join(" "), color, lineWidth, strokeOptions, "cubicBezier");
|
|
1702
|
-
return node;
|
|
1703
|
-
};
|
|
1704
|
-
drawutilssvg.HEAD_XML = [
|
|
1705
|
-
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
|
|
1706
|
-
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ',
|
|
1707
|
-
' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
|
1708
|
-
""
|
|
1709
|
-
].join("\n");
|
|
1710
|
-
return drawutilssvg;
|
|
1711
|
-
}());
|
|
1712
|
-
exports.drawutilssvg = drawutilssvg;
|
|
1713
|
-
//# sourceMappingURL=drawutilssvg.js.map
|