plotboilerplate 1.24.0 → 1.26.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 +14 -1
- package/dist/index.esm.js +433 -162
- 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 +12312 -12041
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +9 -5
- package/src/cjs/Bounds.d.ts +79 -25
- package/src/cjs/Bounds.js +102 -29
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +3 -0
- package/src/cjs/CircleSector.js +28 -1
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +37 -6
- package/src/cjs/PlotBoilerplate.js +222 -116
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.d.ts +26 -7
- package/src/cjs/Polygon.js +56 -10
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Triangle.js +2 -2
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/Vertex.d.ts +15 -3
- package/src/cjs/Vertex.js +18 -1
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +2 -1
- package/src/cjs/drawutilssvg.js +9 -3
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +28 -0
- package/src/cjs/interfaces/core.js +2 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/utils/LissajousFigure.d.ts +34 -0
- package/src/cjs/utils/LissajousFigure.js +100 -0
- package/src/cjs/utils/LissajousFigure.js.map +1 -0
- package/src/cjs/utils/PerlinNoise.d.ts +19 -0
- package/src/cjs/utils/PerlinNoise.js +352 -0
- package/src/cjs/utils/PerlinNoise.js.map +1 -0
- package/src/cjs/utils/SVGPathUtils.d.ts +22 -0
- package/src/cjs/utils/SVGPathUtils.js +45 -0
- package/src/cjs/utils/SVGPathUtils.js.map +1 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/cjs/utils/datastructures/Color.d.ts +147 -1
- package/src/cjs/utils/datastructures/Color.js +385 -41
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/cjs/utils/datastructures/ColorGradient.d.ts +79 -0
- package/src/cjs/utils/datastructures/ColorGradient.js +171 -0
- package/src/cjs/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js +58 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/cjs/utils/detectDarkMode.js +16 -7
- package/src/cjs/utils/detectDarkMode.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +246 -0
- package/src/cjs/utils/dom/components/ColorGradientPicker.js +667 -0
- package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.js +520 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +118 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js +327 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/cjs/utils/dom/components/Test.d.ts +7 -0
- package/src/cjs/utils/dom/components/Test.js +30 -0
- package/src/cjs/utils/dom/components/Test.js.map +1 -0
- package/src/cjs/utils/dom/guiSizeToggler.js +1 -1
- package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +9 -3
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +20 -13
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/cjs/utils/helpers/CircleHelper.d.ts +10 -1
- package/src/cjs/utils/helpers/CircleHelper.js +13 -2
- package/src/cjs/utils/helpers/CircleHelper.js.map +1 -1
- package/src/cjs/utils/helpers/CircleSectorHelper.d.ts +2 -2
- package/src/cjs/utils/helpers/CircleSectorHelper.js +1 -0
- package/src/cjs/utils/helpers/CircleSectorHelper.js.map +1 -1
- package/src/cjs/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/cjs/utils/helpers/TriangleHelper.js +83 -0
- package/src/cjs/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/cjs/utils/helpers/VEllipseHelper.d.ts +6 -4
- package/src/cjs/utils/helpers/VEllipseHelper.js +4 -2
- package/src/cjs/utils/helpers/VEllipseHelper.js.map +1 -1
- package/src/cjs/utils/helpers/VEllipseSectorHelper.d.ts +3 -2
- package/src/cjs/utils/helpers/VEllipseSectorHelper.js +1 -0
- package/src/cjs/utils/helpers/VEllipseSectorHelper.js.map +1 -1
- package/src/cjs/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/cjs/utils/parsers/LinearColorGradientParser.js +224 -0
- package/src/cjs/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/cjs/utils/parsers/svg/types.d.ts +8 -8
- package/src/createDemoDrawables.js +1 -0
- package/src/esm/Bounds.d.ts +79 -25
- package/src/esm/Bounds.js +102 -29
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CircleSector.d.ts +3 -0
- package/src/esm/CircleSector.js +28 -1
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +37 -6
- package/src/esm/PlotBoilerplate.js +222 -116
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.d.ts +26 -7
- package/src/esm/Polygon.js +53 -10
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Triangle.js +2 -2
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/Vertex.d.ts +15 -3
- package/src/esm/Vertex.js +18 -1
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +2 -1
- package/src/esm/drawutilssvg.js +9 -3
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +28 -0
- package/src/esm/interfaces/core.js +2 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/utils/LissajousFigure.d.ts +34 -0
- package/src/esm/utils/LissajousFigure.js +95 -0
- package/src/esm/utils/LissajousFigure.js.map +1 -0
- package/src/esm/utils/PerlinNoise.d.ts +19 -0
- package/src/esm/utils/PerlinNoise.js +346 -0
- package/src/esm/utils/PerlinNoise.js.map +1 -0
- package/src/esm/utils/SVGPathUtils.d.ts +22 -0
- package/src/esm/utils/SVGPathUtils.js +42 -0
- package/src/esm/utils/SVGPathUtils.js.map +1 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/esm/utils/datastructures/Color.d.ts +147 -1
- package/src/esm/utils/datastructures/Color.js +386 -42
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/esm/utils/datastructures/ColorGradient.d.ts +79 -0
- package/src/esm/utils/datastructures/ColorGradient.js +166 -0
- package/src/esm/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/esm/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/esm/utils/datastructures/GeometryMesh.js +53 -0
- package/src/esm/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/esm/utils/detectDarkMode.js +16 -7
- package/src/esm/utils/detectDarkMode.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +246 -0
- package/src/esm/utils/dom/components/ColorGradientPicker.js +743 -0
- package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.js +582 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +118 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js +339 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/esm/utils/dom/components/Test.d.ts +7 -0
- package/src/esm/utils/dom/components/Test.js +26 -0
- package/src/esm/utils/dom/components/Test.js.map +1 -0
- package/src/esm/utils/dom/guiSizeToggler.js +1 -1
- package/src/esm/utils/dom/guiSizeToggler.js.map +1 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +9 -3
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js +20 -13
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/esm/utils/helpers/CircleHelper.d.ts +10 -1
- package/src/esm/utils/helpers/CircleHelper.js +13 -2
- package/src/esm/utils/helpers/CircleHelper.js.map +1 -1
- package/src/esm/utils/helpers/CircleSectorHelper.d.ts +2 -2
- package/src/esm/utils/helpers/CircleSectorHelper.js +1 -0
- package/src/esm/utils/helpers/CircleSectorHelper.js.map +1 -1
- package/src/esm/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/esm/utils/helpers/TriangleHelper.js +78 -0
- package/src/esm/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/esm/utils/helpers/VEllipseHelper.d.ts +6 -4
- package/src/esm/utils/helpers/VEllipseHelper.js +4 -2
- package/src/esm/utils/helpers/VEllipseHelper.js.map +1 -1
- package/src/esm/utils/helpers/VEllipseSectorHelper.d.ts +3 -2
- package/src/esm/utils/helpers/VEllipseSectorHelper.js +1 -0
- package/src/esm/utils/helpers/VEllipseSectorHelper.js.map +1 -1
- package/src/esm/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/esm/utils/parsers/LinearColorGradientParser.js +217 -0
- package/src/esm/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/esm/utils/parsers/svg/types.d.ts +8 -8
- package/src/external.d.ts +9 -0
- package/src/ts/Bounds.ts +107 -22
- package/src/ts/CircleSector.ts +39 -6
- package/src/ts/PlotBoilerplate.ts +233 -105
- package/src/ts/Polygon.ts +68 -14
- package/src/ts/Triangle.ts +2 -2
- package/src/ts/Vertex.ts +21 -3
- package/src/ts/drawutilssvg.ts +8 -3
- package/src/ts/interfaces/core.ts +31 -0
- package/src/ts/utils/LissajousFigure.ts +110 -0
- package/src/ts/utils/PerlinNoise.ts +368 -0
- package/src/ts/utils/SVGPathUtils.ts +55 -0
- package/src/ts/utils/algorithms/pixelCornersToRoundPaths.ts +379 -0
- package/src/ts/utils/datastructures/Color.ts +423 -44
- package/src/ts/utils/datastructures/ColorGradient.ts +196 -0
- package/src/ts/utils/datastructures/DataGrid2d.ts +7 -0
- package/src/ts/utils/datastructures/DataGrid2dArrayMatrix.ts +182 -0
- package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +4 -11
- package/src/ts/utils/datastructures/GeometryMesh.ts +79 -0
- package/src/ts/utils/detectDarkMode.ts +17 -8
- package/src/ts/utils/dom/components/ColorGradientPicker.tsx +889 -0
- package/src/ts/utils/dom/components/ColorGradientSelector.tsx +452 -0
- package/src/ts/utils/dom/components/Test.tsx +44 -0
- package/src/ts/utils/dom/components/_ColorGradientPicker_raw.ts_ +392 -0
- package/src/ts/utils/dom/guiSizeToggler.ts +1 -1
- package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +25 -15
- package/src/ts/utils/helpers/CircleHelper.ts +17 -3
- package/src/ts/utils/helpers/CircleSectorHelper.ts +4 -2
- package/src/ts/utils/helpers/TriangleHelper.ts +102 -0
- package/src/ts/utils/helpers/VEllipseHelper.ts +6 -4
- package/src/ts/utils/helpers/VEllipseSectorHelper.ts +3 -2
- package/src/ts/utils/parsers/LinearColorGradientParser.ts +297 -0
- package/src/ts/utils/parsers/svg/types.ts +8 -8
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for rendering color gradient dropdowns.
|
|
3
|
+
*
|
|
4
|
+
* As native dropdown do not support custom stylings in the way we need, we will implement
|
|
5
|
+
* our own dropdown class.
|
|
6
|
+
*
|
|
7
|
+
* @author Ikaros Kappler
|
|
8
|
+
* @date 2025-08-19
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
import { ColorGradient } from "../../datastructures/ColorGradient";
|
|
12
|
+
export type ColorGradientSelectorChangeListener = (colorGradient: ColorGradient, gradientIndex: number, source: ColorGradientSelector) => void;
|
|
13
|
+
/**
|
|
14
|
+
* The initial properties to use.
|
|
15
|
+
*/
|
|
16
|
+
export interface ColorGradientSelectorProps {
|
|
17
|
+
containerID?: string;
|
|
18
|
+
initialGradients?: Array<ColorGradient>;
|
|
19
|
+
selectedGradientIndex?: number;
|
|
20
|
+
isMobileMode?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class ColorGradientSelector {
|
|
23
|
+
private readonly baseID;
|
|
24
|
+
private readonly elementID;
|
|
25
|
+
private container;
|
|
26
|
+
private containerRef;
|
|
27
|
+
private mainButtonContainerRef;
|
|
28
|
+
private positioningContainerRef;
|
|
29
|
+
private isMobileMode;
|
|
30
|
+
private isDropdownOpen;
|
|
31
|
+
private css_buttonWidth;
|
|
32
|
+
private css_buttonHeight;
|
|
33
|
+
private css_buttonFontSize;
|
|
34
|
+
private css_buttonFontSize_larger;
|
|
35
|
+
private colorGradients;
|
|
36
|
+
private colorGradientOptionRefs;
|
|
37
|
+
private selectedGradientIndex;
|
|
38
|
+
private readonly installedChangeListeners;
|
|
39
|
+
static readonly DEFAULT_COLOR_GRADIENTS: Array<ColorGradient>;
|
|
40
|
+
/**
|
|
41
|
+
* The constructor: creates a new color gradient picker in the given container.
|
|
42
|
+
* If no container or ID is given then a new unbound `container` will be created (DIV).
|
|
43
|
+
*
|
|
44
|
+
* Pass a container ID or nothing – in the latter case the constructor will create
|
|
45
|
+
* a new DIV element.
|
|
46
|
+
*
|
|
47
|
+
* @param {string?} containerID - (optional) If you want to use an existing container (should be a DIV).
|
|
48
|
+
*/
|
|
49
|
+
constructor(options?: ColorGradientSelectorProps);
|
|
50
|
+
setGradients(gradients: Array<ColorGradient>, selectedIndex: number): void;
|
|
51
|
+
addGradient(gradient: ColorGradient): void;
|
|
52
|
+
private __removeAllChildNodes;
|
|
53
|
+
/**
|
|
54
|
+
* Adds a new color gradient change listener to this ColorGradientPicker.
|
|
55
|
+
*
|
|
56
|
+
* @param {ColorGradientChangeListener} listener - The listener to add.
|
|
57
|
+
* @returns {boolean} True, if the listener was added and did not exist before.
|
|
58
|
+
*/
|
|
59
|
+
addChangeListener(listener: ColorGradientSelectorChangeListener): boolean;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param {ColorGradientChangeListener} listener The listener to remove.
|
|
63
|
+
* @returns {boolean} True, if the listener existed and has been removed.
|
|
64
|
+
*/
|
|
65
|
+
removeChangeListener(listener: ColorGradientSelectorChangeListener): boolean;
|
|
66
|
+
getSelectedColorGradient(): ColorGradient;
|
|
67
|
+
private __fireChangeEvent;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a handler for click events on the main button.
|
|
70
|
+
*
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
private __mainButtonClickHandler;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a handler for click events on one of the option button in the dropdown.
|
|
76
|
+
*
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
private __optionButtonClickHandler;
|
|
80
|
+
private __optionButtonDeleteHandler;
|
|
81
|
+
/**
|
|
82
|
+
* Once a slider element was added or removed then the following indices must be updated.
|
|
83
|
+
*
|
|
84
|
+
* @param {number} startIndex - The slider index to start updating at.
|
|
85
|
+
*/
|
|
86
|
+
__updateOptionDataSetIndices(startIndex: number): void;
|
|
87
|
+
private __setSelectedIndex;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the backround color of the main button (of this dropdown) element.
|
|
90
|
+
*
|
|
91
|
+
* @param {ColorGradient} gradient - The gradient color to display. Must not be null.
|
|
92
|
+
*/
|
|
93
|
+
private __setMainButtonGradient;
|
|
94
|
+
/**
|
|
95
|
+
* Renders a new option button for the dropdown menu.
|
|
96
|
+
*
|
|
97
|
+
* @param {ColorGradient} gradient
|
|
98
|
+
* @returns {JsxElement}
|
|
99
|
+
*/
|
|
100
|
+
private __renderOptionButton;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new array of option buttons (refs).
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
private _renderAllOptionButtons;
|
|
106
|
+
/**
|
|
107
|
+
* Init the container contents.
|
|
108
|
+
*
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
private _render;
|
|
112
|
+
/**
|
|
113
|
+
* Adds custom styles (global STYLE tag).
|
|
114
|
+
*
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
private __createCustomStylesElement;
|
|
118
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for rendering color gradient dropdowns.
|
|
3
|
+
*
|
|
4
|
+
* As native dropdown do not support custom stylings in the way we need, we will implement
|
|
5
|
+
* our own dropdown class.
|
|
6
|
+
*
|
|
7
|
+
* @author Ikaros Kappler
|
|
8
|
+
* @date 2025-08-19
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
import * as NoReact from "noreact";
|
|
12
|
+
import { Color } from "../../datastructures/Color";
|
|
13
|
+
import { ColorGradient } from "../../datastructures/ColorGradient";
|
|
14
|
+
export class ColorGradientSelector {
|
|
15
|
+
/**
|
|
16
|
+
* The constructor: creates a new color gradient picker in the given container.
|
|
17
|
+
* If no container or ID is given then a new unbound `container` will be created (DIV).
|
|
18
|
+
*
|
|
19
|
+
* Pass a container ID or nothing – in the latter case the constructor will create
|
|
20
|
+
* a new DIV element.
|
|
21
|
+
*
|
|
22
|
+
* @param {string?} containerID - (optional) If you want to use an existing container (should be a DIV).
|
|
23
|
+
*/
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this.isDropdownOpen = false;
|
|
26
|
+
this.css_buttonWidth = "100px";
|
|
27
|
+
this.css_buttonHeight = "1.8em";
|
|
28
|
+
this.css_buttonFontSize = "0.725em";
|
|
29
|
+
this.css_buttonFontSize_larger = "1.0em";
|
|
30
|
+
this.colorGradients = [];
|
|
31
|
+
// TODO: this does not really need to be a pair, does it?
|
|
32
|
+
this.colorGradientOptionRefs = [];
|
|
33
|
+
this.selectedGradientIndex = -1;
|
|
34
|
+
this.installedChangeListeners = [];
|
|
35
|
+
/**
|
|
36
|
+
* Adds custom styles (global STYLE tag).
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
this.__createCustomStylesElement = () => {
|
|
41
|
+
// Thanks to Ana Tudor
|
|
42
|
+
// https://css-tricks.com/multi-thumb-sliders-particular-two-thumb-case/
|
|
43
|
+
return (NoReact.createElement("style", null, `
|
|
44
|
+
|
|
45
|
+
#${this.elementID} button {
|
|
46
|
+
border: 0px solid lightgray;
|
|
47
|
+
padding: 0.25em;
|
|
48
|
+
/* background-color: rgba(255,255,255,0.9); */
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#${this.elementID} .positioning-container button {
|
|
52
|
+
border-radius: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#${this.elementID} .main-button:hover {
|
|
56
|
+
background-color: rgba(216,216,216,0.9);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#${this.elementID} .option-gradient-button:hover, #${this.elementID} .option-delete-button:hover {
|
|
60
|
+
background-color: rgba(216,216,216,0.9);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
`));
|
|
65
|
+
};
|
|
66
|
+
options = options || {};
|
|
67
|
+
if (options.containerID) {
|
|
68
|
+
const cont = document.getElementById(options.containerID);
|
|
69
|
+
if (!cont) {
|
|
70
|
+
throw "Cannot create ColorGradientPicker. Component ID does not exist.";
|
|
71
|
+
}
|
|
72
|
+
this.container = cont;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.container = document.createElement("div");
|
|
76
|
+
}
|
|
77
|
+
this.isMobileMode = Boolean(options.isMobileMode);
|
|
78
|
+
if (this.isMobileMode) {
|
|
79
|
+
this.css_buttonWidth = "200px";
|
|
80
|
+
this.css_buttonHeight = "2.5em";
|
|
81
|
+
this.css_buttonFontSize = "1.25em";
|
|
82
|
+
this.css_buttonFontSize_larger = "1.45em";
|
|
83
|
+
}
|
|
84
|
+
this.baseID = Math.floor(Math.random() * 65535);
|
|
85
|
+
this.elementID = `color-gradient-selector-${this.baseID}`;
|
|
86
|
+
this.colorGradients =
|
|
87
|
+
typeof options.initialGradients === "undefined" ? ColorGradientSelector.DEFAULT_COLOR_GRADIENTS : options.initialGradients;
|
|
88
|
+
this.selectedGradientIndex = typeof options.selectedGradientIndex === "undefined" ? 0 : options.selectedGradientIndex;
|
|
89
|
+
document.head.appendChild(this.__createCustomStylesElement());
|
|
90
|
+
this.container.append(this._render());
|
|
91
|
+
} // END constructor
|
|
92
|
+
// TODO: implement this?
|
|
93
|
+
setGradients(gradients, selectedIndex) {
|
|
94
|
+
// First empty the container
|
|
95
|
+
this.__removeAllChildNodes(this.positioningContainerRef.current);
|
|
96
|
+
this.colorGradients = [];
|
|
97
|
+
this.colorGradientOptionRefs = [];
|
|
98
|
+
this.selectedGradientIndex = selectedIndex;
|
|
99
|
+
// Re-render button array
|
|
100
|
+
gradients.map((grad) => {
|
|
101
|
+
this.addGradient(grad);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
addGradient(gradient) {
|
|
105
|
+
// Render a new button
|
|
106
|
+
const index = this.colorGradients.length;
|
|
107
|
+
const refMainContainer = NoReact.useRef();
|
|
108
|
+
const refActionButton = NoReact.useRef();
|
|
109
|
+
const refDeleteButton = NoReact.useRef();
|
|
110
|
+
this.__renderOptionButton(gradient, index, refMainContainer, refActionButton, refDeleteButton);
|
|
111
|
+
this.colorGradients.push(gradient);
|
|
112
|
+
this.colorGradientOptionRefs.push({ mainButton: refActionButton, deleteButton: refDeleteButton });
|
|
113
|
+
// Add to container
|
|
114
|
+
this.positioningContainerRef.current.appendChild(refMainContainer.current);
|
|
115
|
+
}
|
|
116
|
+
// +---------------------------------------------------------------------------------
|
|
117
|
+
// | A helper function to remove all child nodes.
|
|
118
|
+
// +-------------------------------
|
|
119
|
+
__removeAllChildNodes(node) {
|
|
120
|
+
while (node.lastChild) {
|
|
121
|
+
node.removeChild(node.lastChild);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adds a new color gradient change listener to this ColorGradientPicker.
|
|
126
|
+
*
|
|
127
|
+
* @param {ColorGradientChangeListener} listener - The listener to add.
|
|
128
|
+
* @returns {boolean} True, if the listener was added and did not exist before.
|
|
129
|
+
*/
|
|
130
|
+
addChangeListener(listener) {
|
|
131
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
132
|
+
if (this.installedChangeListeners[i] === listener) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
this.installedChangeListeners.push(listener);
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {ColorGradientChangeListener} listener The listener to remove.
|
|
142
|
+
* @returns {boolean} True, if the listener existed and has been removed.
|
|
143
|
+
*/
|
|
144
|
+
removeChangeListener(listener) {
|
|
145
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
146
|
+
if (this.installedChangeListeners[i] === listener) {
|
|
147
|
+
this.installedChangeListeners.splice(i, 1);
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
getSelectedColorGradient() {
|
|
154
|
+
return this.colorGradients[this.selectedGradientIndex];
|
|
155
|
+
}
|
|
156
|
+
__fireChangeEvent() {
|
|
157
|
+
const newColorGradient = this.getSelectedColorGradient();
|
|
158
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
159
|
+
this.installedChangeListeners[i](newColorGradient, this.selectedGradientIndex, this);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a handler for click events on the main button.
|
|
164
|
+
*
|
|
165
|
+
* @returns
|
|
166
|
+
*/
|
|
167
|
+
__mainButtonClickHandler() {
|
|
168
|
+
const _self = this;
|
|
169
|
+
return (_evt) => {
|
|
170
|
+
// _self.mainButtonContainerRef.current.style.visibility = "hidden";
|
|
171
|
+
_self.positioningContainerRef.current.style.visibility = _self.isDropdownOpen ? "hidden" : "visible";
|
|
172
|
+
_self.isDropdownOpen = !_self.isDropdownOpen;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Creates a handler for click events on one of the option button in the dropdown.
|
|
177
|
+
*
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
__optionButtonClickHandler() {
|
|
181
|
+
const _self = this;
|
|
182
|
+
return (evt) => {
|
|
183
|
+
_self.positioningContainerRef.current.style.visibility = "hidden";
|
|
184
|
+
_self.isDropdownOpen = false;
|
|
185
|
+
const targetButton = evt.currentTarget;
|
|
186
|
+
const clickedIndex_raw = targetButton.dataset["gradientIndex"];
|
|
187
|
+
const clickedIndex = Number.parseInt(clickedIndex_raw);
|
|
188
|
+
console.log("clickedIndex", clickedIndex, clickedIndex_raw, targetButton.dataset, targetButton);
|
|
189
|
+
if (Number.isNaN(clickedIndex)) {
|
|
190
|
+
// Stop here. This is not what we want.
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
// Find child: and set selected.
|
|
194
|
+
_self.__setSelectedIndex(clickedIndex);
|
|
195
|
+
_self.__fireChangeEvent();
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
__optionButtonDeleteHandler() {
|
|
199
|
+
const _self = this;
|
|
200
|
+
return (evt) => {
|
|
201
|
+
if (this.colorGradientOptionRefs.length === 1) {
|
|
202
|
+
// Keep the last record
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const targetButton = evt.currentTarget;
|
|
206
|
+
const clickedIndex_raw = targetButton.dataset["gradientIndex"];
|
|
207
|
+
const clickedIndex = Number.parseInt(clickedIndex_raw);
|
|
208
|
+
console.log("clickedIndex", clickedIndex, clickedIndex_raw, targetButton.dataset, targetButton);
|
|
209
|
+
if (Number.isNaN(clickedIndex)) {
|
|
210
|
+
// Stop here. This is not what we want.
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// Find child: and remove from DOM
|
|
214
|
+
console.log("this.colorGradientOptionRefs", this.colorGradientOptionRefs, "clickedIndex", clickedIndex);
|
|
215
|
+
const refPair = this.colorGradientOptionRefs[clickedIndex];
|
|
216
|
+
refPair.mainButton.current.parentElement.remove();
|
|
217
|
+
// Remove from logic
|
|
218
|
+
// Remove 1 element at the given index
|
|
219
|
+
this.colorGradients.splice(clickedIndex, 1);
|
|
220
|
+
this.colorGradientOptionRefs.splice(clickedIndex, 1);
|
|
221
|
+
// Update all following elements in the list.
|
|
222
|
+
this.__updateOptionDataSetIndices(clickedIndex);
|
|
223
|
+
if (this.selectedGradientIndex >= clickedIndex) {
|
|
224
|
+
// this.selectedGradientIndex--;
|
|
225
|
+
this.__setSelectedIndex(this.selectedGradientIndex);
|
|
226
|
+
}
|
|
227
|
+
console.log("All refs", this.colorGradientOptionRefs);
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Once a slider element was added or removed then the following indices must be updated.
|
|
232
|
+
*
|
|
233
|
+
* @param {number} startIndex - The slider index to start updating at.
|
|
234
|
+
*/
|
|
235
|
+
__updateOptionDataSetIndices(startIndex) {
|
|
236
|
+
// Update all elements to the right of the new elelemt
|
|
237
|
+
for (var i = startIndex; i < this.colorGradientOptionRefs.length; i++) {
|
|
238
|
+
this.colorGradientOptionRefs[i].mainButton.current.dataset["gradientIndex"] = `${i}`;
|
|
239
|
+
this.colorGradientOptionRefs[i].deleteButton.current.dataset["gradientIndex"] = `${i}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
__setSelectedIndex(newSelectedIndex) {
|
|
243
|
+
for (var i = 0; i < this.colorGradientOptionRefs.length; i++) {
|
|
244
|
+
const ref = this.colorGradientOptionRefs[i].mainButton;
|
|
245
|
+
// Find child: and set selected.
|
|
246
|
+
ref.current.querySelectorAll(".option-gradient-radio-circle")[0].innerHTML = newSelectedIndex === i ? "🞊" : "🞅";
|
|
247
|
+
}
|
|
248
|
+
this.selectedGradientIndex = newSelectedIndex;
|
|
249
|
+
const selectedGradient = this.colorGradients[this.selectedGradientIndex];
|
|
250
|
+
// Display new gradient in the main button
|
|
251
|
+
this.__setMainButtonGradient(selectedGradient);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Sets the backround color of the main button (of this dropdown) element.
|
|
255
|
+
*
|
|
256
|
+
* @param {ColorGradient} gradient - The gradient color to display. Must not be null.
|
|
257
|
+
*/
|
|
258
|
+
__setMainButtonGradient(gradient) {
|
|
259
|
+
const colorDisplay = this.mainButtonContainerRef.current.querySelectorAll(".main-button-gradient-display")[0];
|
|
260
|
+
colorDisplay.style["background"] = gradient.toColorGradientString();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Renders a new option button for the dropdown menu.
|
|
264
|
+
*
|
|
265
|
+
* @param {ColorGradient} gradient
|
|
266
|
+
* @returns {JsxElement}
|
|
267
|
+
*/
|
|
268
|
+
__renderOptionButton(gradient, index, refMainContainer, refActionButton, refDelButton) {
|
|
269
|
+
return (NoReact.createElement("div", { sx: { d: "flex", flexDirection: "row" }, ref: refMainContainer },
|
|
270
|
+
NoReact.createElement("button", { className: "option-gradient-button", onClick: this.__optionButtonClickHandler(), style: {
|
|
271
|
+
d: "flex",
|
|
272
|
+
w: "100%",
|
|
273
|
+
fontSize: this.css_buttonFontSize,
|
|
274
|
+
minHeight: this.css_buttonHeight,
|
|
275
|
+
maxHeight: this.css_buttonHeight
|
|
276
|
+
}, ref: refActionButton, "data-gradientIndex": `${index}` },
|
|
277
|
+
NoReact.createElement("div", { className: "option-gradient-radio-circle", sx: { w: "2em", flexShrink: 2, alignContent: "center" } }, index === 0 ? "🞊" : "🞅"),
|
|
278
|
+
NoReact.createElement("div", { sx: { w: "calc( 100% - 2em )", mr: "1em", background: gradient.toColorGradientString() } }, "\u00A0")),
|
|
279
|
+
NoReact.createElement("button", { classname: "option-delete-button", sx: { fontSize: this.css_buttonFontSize, minHeight: this.css_buttonHeight, maxHeight: this.css_buttonHeight }, onClick: this.__optionButtonDeleteHandler(), "data-gradientIndex": `${index}`, ref: refDelButton },
|
|
280
|
+
NoReact.createElement("div", { sx: { w: "2em", flexShrink: 2, alignContent: "center" } }, "\uD83D\uDDD1"))));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Creates a new array of option buttons (refs).
|
|
284
|
+
* @returns
|
|
285
|
+
*/
|
|
286
|
+
_renderAllOptionButtons() {
|
|
287
|
+
const _self = this;
|
|
288
|
+
// First clear all references
|
|
289
|
+
_self.colorGradientOptionRefs = [];
|
|
290
|
+
return this.colorGradients.map((colorGradient, index) => {
|
|
291
|
+
// console.log("num", num, index);
|
|
292
|
+
const refMainContainer = NoReact.useRef();
|
|
293
|
+
const refActionButton = NoReact.useRef();
|
|
294
|
+
const refDelButton = NoReact.useRef();
|
|
295
|
+
_self.colorGradientOptionRefs.push({ mainButton: refActionButton, deleteButton: refDelButton });
|
|
296
|
+
return this.__renderOptionButton(colorGradient, index, refMainContainer, refActionButton, refDelButton);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Init the container contents.
|
|
301
|
+
*
|
|
302
|
+
* @private
|
|
303
|
+
*/
|
|
304
|
+
_render() {
|
|
305
|
+
const _self = this;
|
|
306
|
+
// console.log("Rendering ...", NoReact);
|
|
307
|
+
this.containerRef = NoReact.useRef();
|
|
308
|
+
this.mainButtonContainerRef = NoReact.useRef();
|
|
309
|
+
this.positioningContainerRef = NoReact.useRef();
|
|
310
|
+
const selectedGradient = this.colorGradients[this.selectedGradientIndex];
|
|
311
|
+
return (NoReact.createElement("div", { id: this.elementID, className: "color-gradient-selector", style: { minWidth: this.css_buttonWidth, maxWidth: this.css_buttonWidth, pos: "relative" }, ref: this.containerRef },
|
|
312
|
+
NoReact.createElement("button", { className: "main-button", ref: this.mainButtonContainerRef, style: {
|
|
313
|
+
d: "flex",
|
|
314
|
+
minWidth: this.css_buttonWidth,
|
|
315
|
+
maxWidth: this.css_buttonWidth,
|
|
316
|
+
minHeight: this.css_buttonHeight,
|
|
317
|
+
maxHeight: this.css_buttonHeight
|
|
318
|
+
}, onClick: this.__mainButtonClickHandler() },
|
|
319
|
+
NoReact.createElement("div", { className: "main-button-gradient-display", sx: { w: `calc( 100% - ${this.css_buttonFontSize} )`, background: selectedGradient.toColorGradientString() } }, "\u00A0"),
|
|
320
|
+
NoReact.createElement("div", { sx: { w: this.css_buttonHeight, flexShrink: 2, fontSize: this.css_buttonFontSize_larger } }, "\u25BE")),
|
|
321
|
+
NoReact.createElement("div", { className: "positioning-container", ref: this.positioningContainerRef, style: {
|
|
322
|
+
minWidth: this.css_buttonWidth,
|
|
323
|
+
maxHeight: "25vh",
|
|
324
|
+
overflowY: "auto",
|
|
325
|
+
v: "hidden",
|
|
326
|
+
d: "flex",
|
|
327
|
+
fd: "column",
|
|
328
|
+
pos: "absolute",
|
|
329
|
+
l: 0,
|
|
330
|
+
zIndex: 999
|
|
331
|
+
} }, _self._renderAllOptionButtons())));
|
|
332
|
+
} // END function render()
|
|
333
|
+
}
|
|
334
|
+
ColorGradientSelector.DEFAULT_COLOR_GRADIENTS = [
|
|
335
|
+
ColorGradient.createDefault(),
|
|
336
|
+
ColorGradient.createFrom(Color.Red, Color.Green),
|
|
337
|
+
ColorGradient.createFrom(Color.Blue, Color.Gold)
|
|
338
|
+
];
|
|
339
|
+
//# sourceMappingURL=ColorGradientSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorGradientSelector.js","sourceRoot":"","sources":["../../../../ts/utils/dom/components/ColorGradientSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAkBnE,MAAM,OAAO,qBAAqB;IAiChC;;;;;;;;OAQG;IACH,YAAY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OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE;gBAExC,+BACE,SAAS,EAAC,8BAA8B,EACxC,EAAE,EAAE,EAAE,CAAC,EAAE,gBAAgB,IAAI,CAAC,kBAAkB,IAAI,EAAE,UAAU,EAAE,gBAAgB,CAAC,qBAAqB,EAAE,EAAE,aAGxG;gBACN,+BAAK,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,yBAAyB,EAAE,aAAS,CAChG;YACT,+BACE,SAAS,EAAC,uBAAuB,EACjC,GAAG,EAAE,IAAI,CAAC,uBAAuB,EACjC,KAAK,EAAE;oBACL,QAAQ,EAAE,IAAI,CAAC,eAAe;oBAC9B,SAAS,EAAE,MAAM;oBACjB,SAAS,EAAE,MAAM;oBACjB,CAAC,EAAE,QAAQ;oBACX,CAAC,EAAE,MAAM;oBACT,EAAE,EAAE,QAAQ;oBACZ,GAAG,EAAE,UAAU;oBACf,CAAC,EAAE,CAAC;oBACJ,MAAM,EAAE,GAAG;iBACZ,IAEA,KAAK,CAAC,uBAAuB,EAAE,CAC5B,CACF,CACP,CAAC;IACJ,CAAC,CAAC,wBAAwB;;AApWH,6CAAuB,GAAyB;IACrE,aAAa,CAAC,aAAa,EAAE;IAC7B,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;IAChD,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CACjD,AAJ6C,CAI5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Ikaros Kappler
|
|
3
|
+
* @date 2025-06-25
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as NoReact from "noreact";
|
|
7
|
+
export const Test = (name) => {
|
|
8
|
+
const click1 = () => {
|
|
9
|
+
console.log("First clicked");
|
|
10
|
+
};
|
|
11
|
+
const click2 = () => {
|
|
12
|
+
console.log("Second clicked");
|
|
13
|
+
};
|
|
14
|
+
const mouseEnter = (event) => {
|
|
15
|
+
event.target.style["background-color"] = "grey";
|
|
16
|
+
};
|
|
17
|
+
const mouseOut = (event) => {
|
|
18
|
+
event.target.style["background-color"] = "DeepSkyBlue";
|
|
19
|
+
};
|
|
20
|
+
return (NoReact.createElement("div", { className: "NoReact-main" },
|
|
21
|
+
"Hello ",
|
|
22
|
+
name,
|
|
23
|
+
NoReact.createElement("div", { className: "NoReact-child-1", onClick: click1 }, "Hello Nested"),
|
|
24
|
+
NoReact.createElement("div", { className: "NoReact-child-2", onClick: click2, onMouseEnter: mouseEnter, onMouseOut: mouseOut, style: { backgroundColor: "yellow" } }, "Hello Nested 2")));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Test.js","sourceRoot":"","sources":["../../../../ts/utils/dom/components/Test.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAc,EAAE;IAC/C,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,EAAE;QACjC,KAAK,CAAC,MAAyB,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;IACtE,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,EAAE;QAC/B,KAAK,CAAC,MAAyB,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,aAAa,CAAC;IAC7E,CAAC,CAAC;IAEF,OAAO,CACL,+BAAK,SAAS,EAAC,cAAc;;QACpB,IAAI;QACX,+BAAK,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,MAAM,mBAE1C;QACN,+BACE,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,UAAU,EACxB,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,qBAGhC,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -21,7 +21,7 @@ const applyGuiSize = (gui, guiDoubleSize, cssProps) => {
|
|
|
21
21
|
gui.domElement.style["transform-origin"] = "100% 0%";
|
|
22
22
|
}
|
|
23
23
|
const transform = cssProps && cssProps.hasOwnProperty("transform") ? cssProps["transform"] + " " : "";
|
|
24
|
-
console.log("transform", transform);
|
|
24
|
+
// console.log("transform", transform);
|
|
25
25
|
if (guiDoubleSize) {
|
|
26
26
|
gui.domElement.style["transform"] = transform + "scale(2.0)";
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guiSizeToggler.js","sourceRoot":"","sources":["../../../ts/utils/dom/guiSizeToggler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,GAAQ,EAAE,aAAsB,EAAE,QAAgC,EAAE,EAAE;IAC1F,IAAI,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACzE,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC;IACvD,CAAC;IAED,MAAM,SAAS,GAAG,QAAQ,IA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,MAAM,EAAE;YACN,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
* @modified 2025-04-14 Added the `BezierPathInteractionHelper.drawHandleLines` method.
|
|
26
26
|
* @modified 2025-04-14 Fixing correct event types for touch events in `BezierPathInteractionHelper`.
|
|
27
27
|
* @modified 2025-04-14 BezierPathInteractionHelper: Changed default value of `HelperOptions.autoAdjustPaths` from `true` to `false`.
|
|
28
|
-
* @
|
|
28
|
+
* @modified 2025-05-05 Added optional params `draw` and `fill` to BezierPathInteractionHelper.drawHandleLines` method.
|
|
29
|
+
* @modified 2025-05-05 Class `BezierPathInteractionHelper` now implementing `IShapeInteractionHelper`.
|
|
30
|
+
* @modified 2025-05-07 Tweaking performance of `BezierPathInteractionHelper`: only triggering redraw now when mouse move within given detect range.
|
|
31
|
+
* @version 1.2.1
|
|
29
32
|
*
|
|
30
33
|
* @file BezierPathInteractionHelper
|
|
31
34
|
* @public
|
|
@@ -34,6 +37,7 @@ import { BezierPath } from "../../BezierPath";
|
|
|
34
37
|
import { PlotBoilerplate } from "../../PlotBoilerplate";
|
|
35
38
|
import { VertListener } from "../../VertexListeners";
|
|
36
39
|
import { Vertex } from "../../Vertex";
|
|
40
|
+
import { DrawLib, IShapeInteractionHelper } from "../../interfaces";
|
|
37
41
|
/**
|
|
38
42
|
* Handler type for mouse-pointer-moved listeners.
|
|
39
43
|
*/
|
|
@@ -73,7 +77,7 @@ interface HelperOptions {
|
|
|
73
77
|
*
|
|
74
78
|
* @public
|
|
75
79
|
**/
|
|
76
|
-
export declare class BezierPathInteractionHelper {
|
|
80
|
+
export declare class BezierPathInteractionHelper implements IShapeInteractionHelper {
|
|
77
81
|
/**
|
|
78
82
|
* @member {PlotBoilerplate} pb
|
|
79
83
|
* @memberof BezierPathInteractionHelper
|
|
@@ -170,8 +174,10 @@ export declare class BezierPathInteractionHelper {
|
|
|
170
174
|
/**
|
|
171
175
|
* Draw grey handle lines.
|
|
172
176
|
*
|
|
177
|
+
* @param {DrawLib<any>} draw - (optional) The draw library to use. If not provided then `pb.draw` will be used.
|
|
178
|
+
* @param {DrawLib<any>} fill - (optional) The fill library to use. If not provided then `pb.fill` will be used.
|
|
173
179
|
*/
|
|
174
|
-
drawHandleLines(): void;
|
|
180
|
+
drawHandleLines(draw?: DrawLib<any>, fill?: DrawLib<any>): void;
|
|
175
181
|
/**
|
|
176
182
|
* This function should invalidate any installed listeners and invalidate this object.
|
|
177
183
|
* After calling this function the object might not hold valid data any more and
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
* @modified 2025-04-14 Added the `BezierPathInteractionHelper.drawHandleLines` method.
|
|
26
26
|
* @modified 2025-04-14 Fixing correct event types for touch events in `BezierPathInteractionHelper`.
|
|
27
27
|
* @modified 2025-04-14 BezierPathInteractionHelper: Changed default value of `HelperOptions.autoAdjustPaths` from `true` to `false`.
|
|
28
|
-
* @
|
|
28
|
+
* @modified 2025-05-05 Added optional params `draw` and `fill` to BezierPathInteractionHelper.drawHandleLines` method.
|
|
29
|
+
* @modified 2025-05-05 Class `BezierPathInteractionHelper` now implementing `IShapeInteractionHelper`.
|
|
30
|
+
* @modified 2025-05-07 Tweaking performance of `BezierPathInteractionHelper`: only triggering redraw now when mouse move within given detect range.
|
|
31
|
+
* @version 1.2.1
|
|
29
32
|
*
|
|
30
33
|
* @file BezierPathInteractionHelper
|
|
31
34
|
* @public
|
|
@@ -187,8 +190,12 @@ export class BezierPathInteractionHelper {
|
|
|
187
190
|
/**
|
|
188
191
|
* Draw grey handle lines.
|
|
189
192
|
*
|
|
193
|
+
* @param {DrawLib<any>} draw - (optional) The draw library to use. If not provided then `pb.draw` will be used.
|
|
194
|
+
* @param {DrawLib<any>} fill - (optional) The fill library to use. If not provided then `pb.fill` will be used.
|
|
190
195
|
*/
|
|
191
|
-
drawHandleLines() {
|
|
196
|
+
drawHandleLines(draw, fill) {
|
|
197
|
+
draw = draw || this.pb.draw;
|
|
198
|
+
fill = fill || this.pb.fill;
|
|
192
199
|
this.paths.forEach((path) => {
|
|
193
200
|
path.bezierCurves.forEach((curve) => {
|
|
194
201
|
this.pb.draw.line(curve.startPoint, curve.startControlPoint, "rgba(64,192,128,0.333)", 1.0, {
|
|
@@ -342,6 +349,9 @@ export class BezierPathInteractionHelper {
|
|
|
342
349
|
// | Touch and mouse events should call this fuction when the pointer was moved.
|
|
343
350
|
// +-------------------------------
|
|
344
351
|
_handleMoveEvent(posX, posY) {
|
|
352
|
+
const oldA = this.currentA.clone();
|
|
353
|
+
const oldB = this.currentB.clone();
|
|
354
|
+
const oldDistance = this.currentDistance;
|
|
345
355
|
const point = this.pb.transformMousePosition(posX, posY);
|
|
346
356
|
this.currentB.set(point);
|
|
347
357
|
this._updateMinDistance();
|
|
@@ -352,8 +362,12 @@ export class BezierPathInteractionHelper {
|
|
|
352
362
|
else {
|
|
353
363
|
this.onPointerMoved(-1, null, null, 0.0);
|
|
354
364
|
}
|
|
355
|
-
//
|
|
356
|
-
this.
|
|
365
|
+
// Only redraw when moving inside the detection distance
|
|
366
|
+
if ((this.currentDistance <= this.maxDetectDistance ||
|
|
367
|
+
(this.currentDistance > this.maxDetectDistance && oldDistance <= this.maxDetectDistance)) &&
|
|
368
|
+
(!oldA.equals(this.currentA) || !oldB.equals(this.currentB))) {
|
|
369
|
+
this.pb.redraw();
|
|
370
|
+
}
|
|
357
371
|
}
|
|
358
372
|
// +---------------------------------------------------------------------------------
|
|
359
373
|
// | This is called when the mouse pointer leaves the canvas or
|
|
@@ -369,23 +383,15 @@ export class BezierPathInteractionHelper {
|
|
|
369
383
|
_installTouchListener() {
|
|
370
384
|
var _self = this;
|
|
371
385
|
const afProps = {
|
|
372
|
-
// Todo: which event types does AlloyFinger use?
|
|
373
|
-
// touchStart: function (_event: TouchEvent) {
|
|
374
|
-
// _self.mouseIsOver = true;
|
|
375
|
-
// },
|
|
376
|
-
// /* TouchMoveEvent , AFTouchEvent<"touchStart"> */
|
|
377
386
|
touchStart: function (_event) {
|
|
378
387
|
_self.mouseIsOver = true;
|
|
379
388
|
},
|
|
380
389
|
touchMove: function (event) {
|
|
381
|
-
// TouchEvent) {
|
|
382
390
|
if (_self.pb.getDraggedElementCount() == 0 && event.touches.length > 0) {
|
|
383
|
-
// console.log('touchmove');
|
|
384
391
|
_self._handleMoveEvent(event.touches[0].clientX, event.touches[0].clientY);
|
|
385
392
|
}
|
|
386
393
|
},
|
|
387
394
|
touchEnd: function (_event) {
|
|
388
|
-
// TouchEvent) {
|
|
389
395
|
_self.mouseIsOver = false;
|
|
390
396
|
_self._clearMoveEvent();
|
|
391
397
|
}
|
|
@@ -472,8 +478,9 @@ export class BezierPathInteractionHelper {
|
|
|
472
478
|
// | Update the min distance from point `line.b` to the curve. And redraw.
|
|
473
479
|
// +-------------------------------
|
|
474
480
|
_updateMinDistance() {
|
|
475
|
-
if (this.paths.length == 0)
|
|
481
|
+
if (this.paths.length == 0) {
|
|
476
482
|
return;
|
|
483
|
+
}
|
|
477
484
|
let pathIndex = -1;
|
|
478
485
|
let minDist = Number.MAX_VALUE;
|
|
479
486
|
let closestPoint = null;
|