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,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A simple class for rendering color gradient dropdowns.
|
|
4
|
+
*
|
|
5
|
+
* As native dropdown do not support custom stylings in the way we need, we will implement
|
|
6
|
+
* our own dropdown class.
|
|
7
|
+
*
|
|
8
|
+
* @author Ikaros Kappler
|
|
9
|
+
* @date 2025-08-19
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ColorGradientSelector = void 0;
|
|
14
|
+
var NoReact = require("noreact");
|
|
15
|
+
var Color_1 = require("../../datastructures/Color");
|
|
16
|
+
var ColorGradient_1 = require("../../datastructures/ColorGradient");
|
|
17
|
+
var ColorGradientSelector = /** @class */ (function () {
|
|
18
|
+
/**
|
|
19
|
+
* The constructor: creates a new color gradient picker in the given container.
|
|
20
|
+
* If no container or ID is given then a new unbound `container` will be created (DIV).
|
|
21
|
+
*
|
|
22
|
+
* Pass a container ID or nothing – in the latter case the constructor will create
|
|
23
|
+
* a new DIV element.
|
|
24
|
+
*
|
|
25
|
+
* @param {string?} containerID - (optional) If you want to use an existing container (should be a DIV).
|
|
26
|
+
*/
|
|
27
|
+
function ColorGradientSelector(options) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
this.isDropdownOpen = false;
|
|
30
|
+
this.css_buttonWidth = "100px";
|
|
31
|
+
this.css_buttonHeight = "1.8em";
|
|
32
|
+
this.css_buttonFontSize = "0.725em";
|
|
33
|
+
this.css_buttonFontSize_larger = "1.0em";
|
|
34
|
+
this.colorGradients = [];
|
|
35
|
+
// TODO: this does not really need to be a pair, does it?
|
|
36
|
+
this.colorGradientOptionRefs = [];
|
|
37
|
+
this.selectedGradientIndex = -1;
|
|
38
|
+
this.installedChangeListeners = [];
|
|
39
|
+
/**
|
|
40
|
+
* Adds custom styles (global STYLE tag).
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
this.__createCustomStylesElement = function () {
|
|
45
|
+
// Thanks to Ana Tudor
|
|
46
|
+
// https://css-tricks.com/multi-thumb-sliders-particular-two-thumb-case/
|
|
47
|
+
return (NoReact.createElement("style", null, "\n\n #".concat(_this.elementID, " button {\n border: 0px solid lightgray;\n padding: 0.25em;\n /* background-color: rgba(255,255,255,0.9); */\n }\n\n #").concat(_this.elementID, " .positioning-container button {\n border-radius: 0;\n }\n\n #").concat(_this.elementID, " .main-button:hover {\n background-color: rgba(216,216,216,0.9);\n }\n\n #").concat(_this.elementID, " .option-gradient-button:hover, #").concat(_this.elementID, " .option-delete-button:hover {\n background-color: rgba(216,216,216,0.9);\n }\n\n\n ")));
|
|
48
|
+
};
|
|
49
|
+
options = options || {};
|
|
50
|
+
if (options.containerID) {
|
|
51
|
+
var cont = document.getElementById(options.containerID);
|
|
52
|
+
if (!cont) {
|
|
53
|
+
throw "Cannot create ColorGradientPicker. Component ID does not exist.";
|
|
54
|
+
}
|
|
55
|
+
this.container = cont;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.container = document.createElement("div");
|
|
59
|
+
}
|
|
60
|
+
this.isMobileMode = Boolean(options.isMobileMode);
|
|
61
|
+
if (this.isMobileMode) {
|
|
62
|
+
this.css_buttonWidth = "200px";
|
|
63
|
+
this.css_buttonHeight = "2.5em";
|
|
64
|
+
this.css_buttonFontSize = "1.25em";
|
|
65
|
+
this.css_buttonFontSize_larger = "1.45em";
|
|
66
|
+
}
|
|
67
|
+
this.baseID = Math.floor(Math.random() * 65535);
|
|
68
|
+
this.elementID = "color-gradient-selector-".concat(this.baseID);
|
|
69
|
+
this.colorGradients =
|
|
70
|
+
typeof options.initialGradients === "undefined" ? ColorGradientSelector.DEFAULT_COLOR_GRADIENTS : options.initialGradients;
|
|
71
|
+
this.selectedGradientIndex = typeof options.selectedGradientIndex === "undefined" ? 0 : options.selectedGradientIndex;
|
|
72
|
+
document.head.appendChild(this.__createCustomStylesElement());
|
|
73
|
+
this.container.append(this._render());
|
|
74
|
+
} // END constructor
|
|
75
|
+
// TODO: implement this?
|
|
76
|
+
ColorGradientSelector.prototype.setGradients = function (gradients, selectedIndex) {
|
|
77
|
+
var _this = this;
|
|
78
|
+
// First empty the container
|
|
79
|
+
this.__removeAllChildNodes(this.positioningContainerRef.current);
|
|
80
|
+
this.colorGradients = [];
|
|
81
|
+
this.colorGradientOptionRefs = [];
|
|
82
|
+
this.selectedGradientIndex = selectedIndex;
|
|
83
|
+
// Re-render button array
|
|
84
|
+
gradients.map(function (grad) {
|
|
85
|
+
_this.addGradient(grad);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
ColorGradientSelector.prototype.addGradient = function (gradient) {
|
|
89
|
+
// Render a new button
|
|
90
|
+
var index = this.colorGradients.length;
|
|
91
|
+
var refMainContainer = NoReact.useRef();
|
|
92
|
+
var refActionButton = NoReact.useRef();
|
|
93
|
+
var refDeleteButton = NoReact.useRef();
|
|
94
|
+
this.__renderOptionButton(gradient, index, refMainContainer, refActionButton, refDeleteButton);
|
|
95
|
+
this.colorGradients.push(gradient);
|
|
96
|
+
this.colorGradientOptionRefs.push({ mainButton: refActionButton, deleteButton: refDeleteButton });
|
|
97
|
+
// Add to container
|
|
98
|
+
this.positioningContainerRef.current.appendChild(refMainContainer.current);
|
|
99
|
+
};
|
|
100
|
+
// +---------------------------------------------------------------------------------
|
|
101
|
+
// | A helper function to remove all child nodes.
|
|
102
|
+
// +-------------------------------
|
|
103
|
+
ColorGradientSelector.prototype.__removeAllChildNodes = function (node) {
|
|
104
|
+
while (node.lastChild) {
|
|
105
|
+
node.removeChild(node.lastChild);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Adds a new color gradient change listener to this ColorGradientPicker.
|
|
110
|
+
*
|
|
111
|
+
* @param {ColorGradientChangeListener} listener - The listener to add.
|
|
112
|
+
* @returns {boolean} True, if the listener was added and did not exist before.
|
|
113
|
+
*/
|
|
114
|
+
ColorGradientSelector.prototype.addChangeListener = function (listener) {
|
|
115
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
116
|
+
if (this.installedChangeListeners[i] === listener) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
this.installedChangeListeners.push(listener);
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param {ColorGradientChangeListener} listener The listener to remove.
|
|
126
|
+
* @returns {boolean} True, if the listener existed and has been removed.
|
|
127
|
+
*/
|
|
128
|
+
ColorGradientSelector.prototype.removeChangeListener = function (listener) {
|
|
129
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
130
|
+
if (this.installedChangeListeners[i] === listener) {
|
|
131
|
+
this.installedChangeListeners.splice(i, 1);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
};
|
|
137
|
+
ColorGradientSelector.prototype.getSelectedColorGradient = function () {
|
|
138
|
+
return this.colorGradients[this.selectedGradientIndex];
|
|
139
|
+
};
|
|
140
|
+
ColorGradientSelector.prototype.__fireChangeEvent = function () {
|
|
141
|
+
var newColorGradient = this.getSelectedColorGradient();
|
|
142
|
+
for (var i = 0; i < this.installedChangeListeners.length; i++) {
|
|
143
|
+
this.installedChangeListeners[i](newColorGradient, this.selectedGradientIndex, this);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Creates a handler for click events on the main button.
|
|
148
|
+
*
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
ColorGradientSelector.prototype.__mainButtonClickHandler = function () {
|
|
152
|
+
var _self = this;
|
|
153
|
+
return function (_evt) {
|
|
154
|
+
// _self.mainButtonContainerRef.current.style.visibility = "hidden";
|
|
155
|
+
_self.positioningContainerRef.current.style.visibility = _self.isDropdownOpen ? "hidden" : "visible";
|
|
156
|
+
_self.isDropdownOpen = !_self.isDropdownOpen;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Creates a handler for click events on one of the option button in the dropdown.
|
|
161
|
+
*
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
ColorGradientSelector.prototype.__optionButtonClickHandler = function () {
|
|
165
|
+
var _self = this;
|
|
166
|
+
return function (evt) {
|
|
167
|
+
_self.positioningContainerRef.current.style.visibility = "hidden";
|
|
168
|
+
_self.isDropdownOpen = false;
|
|
169
|
+
var targetButton = evt.currentTarget;
|
|
170
|
+
var clickedIndex_raw = targetButton.dataset["gradientIndex"];
|
|
171
|
+
var clickedIndex = Number.parseInt(clickedIndex_raw);
|
|
172
|
+
console.log("clickedIndex", clickedIndex, clickedIndex_raw, targetButton.dataset, targetButton);
|
|
173
|
+
if (Number.isNaN(clickedIndex)) {
|
|
174
|
+
// Stop here. This is not what we want.
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
// Find child: and set selected.
|
|
178
|
+
_self.__setSelectedIndex(clickedIndex);
|
|
179
|
+
_self.__fireChangeEvent();
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
ColorGradientSelector.prototype.__optionButtonDeleteHandler = function () {
|
|
183
|
+
var _this = this;
|
|
184
|
+
var _self = this;
|
|
185
|
+
return function (evt) {
|
|
186
|
+
if (_this.colorGradientOptionRefs.length === 1) {
|
|
187
|
+
// Keep the last record
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
var targetButton = evt.currentTarget;
|
|
191
|
+
var clickedIndex_raw = targetButton.dataset["gradientIndex"];
|
|
192
|
+
var clickedIndex = Number.parseInt(clickedIndex_raw);
|
|
193
|
+
console.log("clickedIndex", clickedIndex, clickedIndex_raw, targetButton.dataset, targetButton);
|
|
194
|
+
if (Number.isNaN(clickedIndex)) {
|
|
195
|
+
// Stop here. This is not what we want.
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Find child: and remove from DOM
|
|
199
|
+
console.log("this.colorGradientOptionRefs", _this.colorGradientOptionRefs, "clickedIndex", clickedIndex);
|
|
200
|
+
var refPair = _this.colorGradientOptionRefs[clickedIndex];
|
|
201
|
+
refPair.mainButton.current.parentElement.remove();
|
|
202
|
+
// Remove from logic
|
|
203
|
+
// Remove 1 element at the given index
|
|
204
|
+
_this.colorGradients.splice(clickedIndex, 1);
|
|
205
|
+
_this.colorGradientOptionRefs.splice(clickedIndex, 1);
|
|
206
|
+
// Update all following elements in the list.
|
|
207
|
+
_this.__updateOptionDataSetIndices(clickedIndex);
|
|
208
|
+
if (_this.selectedGradientIndex >= clickedIndex) {
|
|
209
|
+
// this.selectedGradientIndex--;
|
|
210
|
+
_this.__setSelectedIndex(_this.selectedGradientIndex);
|
|
211
|
+
}
|
|
212
|
+
console.log("All refs", _this.colorGradientOptionRefs);
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Once a slider element was added or removed then the following indices must be updated.
|
|
217
|
+
*
|
|
218
|
+
* @param {number} startIndex - The slider index to start updating at.
|
|
219
|
+
*/
|
|
220
|
+
ColorGradientSelector.prototype.__updateOptionDataSetIndices = function (startIndex) {
|
|
221
|
+
// Update all elements to the right of the new elelemt
|
|
222
|
+
for (var i = startIndex; i < this.colorGradientOptionRefs.length; i++) {
|
|
223
|
+
this.colorGradientOptionRefs[i].mainButton.current.dataset["gradientIndex"] = "".concat(i);
|
|
224
|
+
this.colorGradientOptionRefs[i].deleteButton.current.dataset["gradientIndex"] = "".concat(i);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
ColorGradientSelector.prototype.__setSelectedIndex = function (newSelectedIndex) {
|
|
228
|
+
for (var i = 0; i < this.colorGradientOptionRefs.length; i++) {
|
|
229
|
+
var ref = this.colorGradientOptionRefs[i].mainButton;
|
|
230
|
+
// Find child: and set selected.
|
|
231
|
+
ref.current.querySelectorAll(".option-gradient-radio-circle")[0].innerHTML = newSelectedIndex === i ? "🞊" : "🞅";
|
|
232
|
+
}
|
|
233
|
+
this.selectedGradientIndex = newSelectedIndex;
|
|
234
|
+
var selectedGradient = this.colorGradients[this.selectedGradientIndex];
|
|
235
|
+
// Display new gradient in the main button
|
|
236
|
+
this.__setMainButtonGradient(selectedGradient);
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Sets the backround color of the main button (of this dropdown) element.
|
|
240
|
+
*
|
|
241
|
+
* @param {ColorGradient} gradient - The gradient color to display. Must not be null.
|
|
242
|
+
*/
|
|
243
|
+
ColorGradientSelector.prototype.__setMainButtonGradient = function (gradient) {
|
|
244
|
+
var colorDisplay = this.mainButtonContainerRef.current.querySelectorAll(".main-button-gradient-display")[0];
|
|
245
|
+
colorDisplay.style["background"] = gradient.toColorGradientString();
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Renders a new option button for the dropdown menu.
|
|
249
|
+
*
|
|
250
|
+
* @param {ColorGradient} gradient
|
|
251
|
+
* @returns {JsxElement}
|
|
252
|
+
*/
|
|
253
|
+
ColorGradientSelector.prototype.__renderOptionButton = function (gradient, index, refMainContainer, refActionButton, refDelButton) {
|
|
254
|
+
return (NoReact.createElement("div", { sx: { d: "flex", flexDirection: "row" }, ref: refMainContainer },
|
|
255
|
+
NoReact.createElement("button", { className: "option-gradient-button", onClick: this.__optionButtonClickHandler(), style: {
|
|
256
|
+
d: "flex",
|
|
257
|
+
w: "100%",
|
|
258
|
+
fontSize: this.css_buttonFontSize,
|
|
259
|
+
minHeight: this.css_buttonHeight,
|
|
260
|
+
maxHeight: this.css_buttonHeight
|
|
261
|
+
}, ref: refActionButton, "data-gradientIndex": "".concat(index) },
|
|
262
|
+
NoReact.createElement("div", { className: "option-gradient-radio-circle", sx: { w: "2em", flexShrink: 2, alignContent: "center" } }, index === 0 ? "🞊" : "🞅"),
|
|
263
|
+
NoReact.createElement("div", { sx: { w: "calc( 100% - 2em )", mr: "1em", background: gradient.toColorGradientString() } }, "\u00A0")),
|
|
264
|
+
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": "".concat(index), ref: refDelButton },
|
|
265
|
+
NoReact.createElement("div", { sx: { w: "2em", flexShrink: 2, alignContent: "center" } }, "\uD83D\uDDD1"))));
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Creates a new array of option buttons (refs).
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
ColorGradientSelector.prototype._renderAllOptionButtons = function () {
|
|
272
|
+
var _this = this;
|
|
273
|
+
var _self = this;
|
|
274
|
+
// First clear all references
|
|
275
|
+
_self.colorGradientOptionRefs = [];
|
|
276
|
+
return this.colorGradients.map(function (colorGradient, index) {
|
|
277
|
+
// console.log("num", num, index);
|
|
278
|
+
var refMainContainer = NoReact.useRef();
|
|
279
|
+
var refActionButton = NoReact.useRef();
|
|
280
|
+
var refDelButton = NoReact.useRef();
|
|
281
|
+
_self.colorGradientOptionRefs.push({ mainButton: refActionButton, deleteButton: refDelButton });
|
|
282
|
+
return _this.__renderOptionButton(colorGradient, index, refMainContainer, refActionButton, refDelButton);
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Init the container contents.
|
|
287
|
+
*
|
|
288
|
+
* @private
|
|
289
|
+
*/
|
|
290
|
+
ColorGradientSelector.prototype._render = function () {
|
|
291
|
+
var _self = this;
|
|
292
|
+
// console.log("Rendering ...", NoReact);
|
|
293
|
+
this.containerRef = NoReact.useRef();
|
|
294
|
+
this.mainButtonContainerRef = NoReact.useRef();
|
|
295
|
+
this.positioningContainerRef = NoReact.useRef();
|
|
296
|
+
var selectedGradient = this.colorGradients[this.selectedGradientIndex];
|
|
297
|
+
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 },
|
|
298
|
+
NoReact.createElement("button", { className: "main-button", ref: this.mainButtonContainerRef, style: {
|
|
299
|
+
d: "flex",
|
|
300
|
+
minWidth: this.css_buttonWidth,
|
|
301
|
+
maxWidth: this.css_buttonWidth,
|
|
302
|
+
minHeight: this.css_buttonHeight,
|
|
303
|
+
maxHeight: this.css_buttonHeight
|
|
304
|
+
}, onClick: this.__mainButtonClickHandler() },
|
|
305
|
+
NoReact.createElement("div", { className: "main-button-gradient-display", sx: { w: "calc( 100% - ".concat(this.css_buttonFontSize, " )"), background: selectedGradient.toColorGradientString() } }, "\u00A0"),
|
|
306
|
+
NoReact.createElement("div", { sx: { w: this.css_buttonHeight, flexShrink: 2, fontSize: this.css_buttonFontSize_larger } }, "\u25BE")),
|
|
307
|
+
NoReact.createElement("div", { className: "positioning-container", ref: this.positioningContainerRef, style: {
|
|
308
|
+
minWidth: this.css_buttonWidth,
|
|
309
|
+
maxHeight: "25vh",
|
|
310
|
+
overflowY: "auto",
|
|
311
|
+
v: "hidden",
|
|
312
|
+
d: "flex",
|
|
313
|
+
fd: "column",
|
|
314
|
+
pos: "absolute",
|
|
315
|
+
l: 0,
|
|
316
|
+
zIndex: 999
|
|
317
|
+
} }, _self._renderAllOptionButtons())));
|
|
318
|
+
}; // END function render()
|
|
319
|
+
ColorGradientSelector.DEFAULT_COLOR_GRADIENTS = [
|
|
320
|
+
ColorGradient_1.ColorGradient.createDefault(),
|
|
321
|
+
ColorGradient_1.ColorGradient.createFrom(Color_1.Color.Red, Color_1.Color.Green),
|
|
322
|
+
ColorGradient_1.ColorGradient.createFrom(Color_1.Color.Blue, Color_1.Color.Gold)
|
|
323
|
+
];
|
|
324
|
+
return ColorGradientSelector;
|
|
325
|
+
}());
|
|
326
|
+
exports.ColorGradientSelector = ColorGradientSelector;
|
|
327
|
+
//# 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,iCAAmC;AAGnC,oDAAmD;AACnD,oEAAmE;AAkBnE;IAiCE;;;;;;;;OAQG;IACH,+BAAY,OAAoC;QAAhD,iBA2BC;QA3DO,mBAAc,GAAY,KAAK,CAAC;QAEhC,oBAAe,GAAG,OAAO,CAAC;QAC1B,qBAAgB,GAAG,OAAO,CAAC;QAC3B,uBAAkB,GAAG,SAAS,CAAC;QAC/B,8BAAyB,GAAG,OAAO,CAAC;QAEpC,mBAAc,GAAyB,EAAE,CAAC;QAClD,yDAAyD;QACjD,4BAAuB,GAG1B,EAAE,CAAC;QACA,0BAAqB,GAAW,CAAC,CAAC,CAAC;QAE1B,6BAAwB,GAA+C,EAAE,CAAC;QAwW3F;;;;WAIG;QACK,gCAA2B,GAAG;YACpC,sBAAsB;YACtB,2EAA2E;YAC3E,OAAO,CACL,qCAAQ,mBAEP,KAAI,CAAC,SAAS,wJAMd,KAAI,CAAC,SAAS,sFAId,KAAI,CAAC,SAAS,kGAId,KAAI,CAAC,SAAS,8CAAoC,KAAI,CAAC,SAAS,oGAKlE,CAAS,CACT,CAAC;QACJ,CAAC,CAAC;QAtXA,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,IAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,iEAAiE,CAAC;YAC1E,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,IA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,CAAC,aAAa,EAAE;QAC7B,6BAAa,CAAC,UAAU,CAAC,aAAK,CAAC,GAAG,EAAE,aAAK,CAAC,KAAK,CAAC;QAChD,6BAAa,CAAC,UAAU,CAAC,aAAK,CAAC,IAAI,EAAE,aAAK,CAAC,IAAI,CAAC;KACjD,AAJ6C,CAI5C;IAmYJ,4BAAC;CAAA,AAlaD,IAkaC;AAlaY,sDAAqB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author Ikaros Kappler
|
|
4
|
+
* @date 2025-06-25
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Test = void 0;
|
|
9
|
+
var NoReact = require("noreact");
|
|
10
|
+
var Test = function (name) {
|
|
11
|
+
var click1 = function () {
|
|
12
|
+
console.log("First clicked");
|
|
13
|
+
};
|
|
14
|
+
var click2 = function () {
|
|
15
|
+
console.log("Second clicked");
|
|
16
|
+
};
|
|
17
|
+
var mouseEnter = function (event) {
|
|
18
|
+
event.target.style["background-color"] = "grey";
|
|
19
|
+
};
|
|
20
|
+
var mouseOut = function (event) {
|
|
21
|
+
event.target.style["background-color"] = "DeepSkyBlue";
|
|
22
|
+
};
|
|
23
|
+
return (NoReact.createElement("div", { className: "NoReact-main" },
|
|
24
|
+
"Hello ",
|
|
25
|
+
name,
|
|
26
|
+
NoReact.createElement("div", { className: "NoReact-child-1", onClick: click1 }, "Hello Nested"),
|
|
27
|
+
NoReact.createElement("div", { className: "NoReact-child-2", onClick: click2, onMouseEnter: mouseEnter, onMouseOut: mouseOut, style: { backgroundColor: "yellow" } }, "Hello Nested 2")));
|
|
28
|
+
};
|
|
29
|
+
exports.Test = Test;
|
|
30
|
+
//# 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,iCAAmC;AAG5B,IAAM,IAAI,GAAG,UAAC,IAAY;IAC/B,IAAM,MAAM,GAAG;QACb,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,IAAM,MAAM,GAAG;QACb,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,IAAM,UAAU,GAAG,UAAC,KAAY;QAC7B,KAAK,CAAC,MAAyB,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;IACtE,CAAC,CAAC;IAEF,IAAM,QAAQ,GAAG,UAAC,KAAY;QAC3B,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;AAlCW,QAAA,IAAI,QAkCf"}
|
|
@@ -24,7 +24,7 @@ var applyGuiSize = function (gui, guiDoubleSize, cssProps) {
|
|
|
24
24
|
gui.domElement.style["transform-origin"] = "100% 0%";
|
|
25
25
|
}
|
|
26
26
|
var transform = cssProps && cssProps.hasOwnProperty("transform") ? cssProps["transform"] + " " : "";
|
|
27
|
-
console.log("transform", transform);
|
|
27
|
+
// console.log("transform", transform);
|
|
28
28
|
if (guiDoubleSize) {
|
|
29
29
|
gui.domElement.style["transform"] = transform + "scale(2.0)";
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guiSizeToggler.js","sourceRoot":"","sources":["../../../ts/utils/dom/guiSizeToggler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAQH;;;;GAIG;AACH,IAAM,YAAY,GAAG,UAAC,GAAQ,EAAE,aAAsB,EAAE,QAAgC;IACtF,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,IAAM,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtG,
|
|
1
|
+
{"version":3,"file":"guiSizeToggler.js","sourceRoot":"","sources":["../../../ts/utils/dom/guiSizeToggler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAQH;;;;GAIG;AACH,IAAM,YAAY,GAAG,UAAC,GAAQ,EAAE,aAAsB,EAAE,QAAgC;IACtF,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,IAAM,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtG,uCAAuC;IACvC,IAAI,aAAa,EAAE,CAAC;QAClB,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AAEK,IAAM,cAAc,GAAG,UAAC,GAAQ,EAAE,MAAsB,EAAE,QAAgC;IAC/F,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAAC;IACtD,OAAO;QACL,MAAM,EAAE;YACN,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
|
|
@@ -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
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
* @modified 2025-04-14 Added the `BezierPathInteractionHelper.drawHandleLines` method.
|
|
27
27
|
* @modified 2025-04-14 Fixing correct event types for touch events in `BezierPathInteractionHelper`.
|
|
28
28
|
* @modified 2025-04-14 BezierPathInteractionHelper: Changed default value of `HelperOptions.autoAdjustPaths` from `true` to `false`.
|
|
29
|
-
* @
|
|
29
|
+
* @modified 2025-05-05 Added optional params `draw` and `fill` to BezierPathInteractionHelper.drawHandleLines` method.
|
|
30
|
+
* @modified 2025-05-05 Class `BezierPathInteractionHelper` now implementing `IShapeInteractionHelper`.
|
|
31
|
+
* @modified 2025-05-07 Tweaking performance of `BezierPathInteractionHelper`: only triggering redraw now when mouse move within given detect range.
|
|
32
|
+
* @version 1.2.1
|
|
30
33
|
*
|
|
31
34
|
* @file BezierPathInteractionHelper
|
|
32
35
|
* @public
|
|
@@ -191,9 +194,13 @@ var BezierPathInteractionHelper = /** @class */ (function () {
|
|
|
191
194
|
/**
|
|
192
195
|
* Draw grey handle lines.
|
|
193
196
|
*
|
|
197
|
+
* @param {DrawLib<any>} draw - (optional) The draw library to use. If not provided then `pb.draw` will be used.
|
|
198
|
+
* @param {DrawLib<any>} fill - (optional) The fill library to use. If not provided then `pb.fill` will be used.
|
|
194
199
|
*/
|
|
195
|
-
BezierPathInteractionHelper.prototype.drawHandleLines = function () {
|
|
200
|
+
BezierPathInteractionHelper.prototype.drawHandleLines = function (draw, fill) {
|
|
196
201
|
var _this = this;
|
|
202
|
+
draw = draw || this.pb.draw;
|
|
203
|
+
fill = fill || this.pb.fill;
|
|
197
204
|
this.paths.forEach(function (path) {
|
|
198
205
|
path.bezierCurves.forEach(function (curve) {
|
|
199
206
|
_this.pb.draw.line(curve.startPoint, curve.startControlPoint, "rgba(64,192,128,0.333)", 1.0, {
|
|
@@ -347,6 +354,9 @@ var BezierPathInteractionHelper = /** @class */ (function () {
|
|
|
347
354
|
// | Touch and mouse events should call this fuction when the pointer was moved.
|
|
348
355
|
// +-------------------------------
|
|
349
356
|
BezierPathInteractionHelper.prototype._handleMoveEvent = function (posX, posY) {
|
|
357
|
+
var oldA = this.currentA.clone();
|
|
358
|
+
var oldB = this.currentB.clone();
|
|
359
|
+
var oldDistance = this.currentDistance;
|
|
350
360
|
var point = this.pb.transformMousePosition(posX, posY);
|
|
351
361
|
this.currentB.set(point);
|
|
352
362
|
this._updateMinDistance();
|
|
@@ -357,8 +367,12 @@ var BezierPathInteractionHelper = /** @class */ (function () {
|
|
|
357
367
|
else {
|
|
358
368
|
this.onPointerMoved(-1, null, null, 0.0);
|
|
359
369
|
}
|
|
360
|
-
//
|
|
361
|
-
this.
|
|
370
|
+
// Only redraw when moving inside the detection distance
|
|
371
|
+
if ((this.currentDistance <= this.maxDetectDistance ||
|
|
372
|
+
(this.currentDistance > this.maxDetectDistance && oldDistance <= this.maxDetectDistance)) &&
|
|
373
|
+
(!oldA.equals(this.currentA) || !oldB.equals(this.currentB))) {
|
|
374
|
+
this.pb.redraw();
|
|
375
|
+
}
|
|
362
376
|
};
|
|
363
377
|
// +---------------------------------------------------------------------------------
|
|
364
378
|
// | This is called when the mouse pointer leaves the canvas or
|
|
@@ -374,23 +388,15 @@ var BezierPathInteractionHelper = /** @class */ (function () {
|
|
|
374
388
|
BezierPathInteractionHelper.prototype._installTouchListener = function () {
|
|
375
389
|
var _self = this;
|
|
376
390
|
var afProps = {
|
|
377
|
-
// Todo: which event types does AlloyFinger use?
|
|
378
|
-
// touchStart: function (_event: TouchEvent) {
|
|
379
|
-
// _self.mouseIsOver = true;
|
|
380
|
-
// },
|
|
381
|
-
// /* TouchMoveEvent , AFTouchEvent<"touchStart"> */
|
|
382
391
|
touchStart: function (_event) {
|
|
383
392
|
_self.mouseIsOver = true;
|
|
384
393
|
},
|
|
385
394
|
touchMove: function (event) {
|
|
386
|
-
// TouchEvent) {
|
|
387
395
|
if (_self.pb.getDraggedElementCount() == 0 && event.touches.length > 0) {
|
|
388
|
-
// console.log('touchmove');
|
|
389
396
|
_self._handleMoveEvent(event.touches[0].clientX, event.touches[0].clientY);
|
|
390
397
|
}
|
|
391
398
|
},
|
|
392
399
|
touchEnd: function (_event) {
|
|
393
|
-
// TouchEvent) {
|
|
394
400
|
_self.mouseIsOver = false;
|
|
395
401
|
_self._clearMoveEvent();
|
|
396
402
|
}
|
|
@@ -477,8 +483,9 @@ var BezierPathInteractionHelper = /** @class */ (function () {
|
|
|
477
483
|
// | Update the min distance from point `line.b` to the curve. And redraw.
|
|
478
484
|
// +-------------------------------
|
|
479
485
|
BezierPathInteractionHelper.prototype._updateMinDistance = function () {
|
|
480
|
-
if (this.paths.length == 0)
|
|
486
|
+
if (this.paths.length == 0) {
|
|
481
487
|
return;
|
|
488
|
+
}
|
|
482
489
|
var pathIndex = -1;
|
|
483
490
|
var minDist = Number.MAX_VALUE;
|
|
484
491
|
var closestPoint = null;
|