@rogieking/figui3 2.18.0 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.css +5 -0
- package/fig.js +21 -29
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -2486,6 +2486,11 @@ fig-input-number {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
2488
|
|
|
2489
|
+
fig-input-number > [slot],
|
|
2490
|
+
fig-input-text[type="number"] > [slot] {
|
|
2491
|
+
cursor: ew-resize !important;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2489
2494
|
fig-input-color,
|
|
2490
2495
|
fig-input-fill {
|
|
2491
2496
|
& > .input-combo > fig-chit:not(:only-child),
|
package/fig.js
CHANGED
|
@@ -2497,30 +2497,27 @@ class FigInputText extends HTMLElement {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
#handleMouseMove(e) {
|
|
2499
2499
|
if (this.type !== "number") return;
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
|
|
2512
|
-
}
|
|
2500
|
+
let step = (this.step || 1) * e.movementX;
|
|
2501
|
+
let value = Number(this.input.value);
|
|
2502
|
+
value = value / (this.transform || 1) + step;
|
|
2503
|
+
value = this.#sanitizeInput(value, false);
|
|
2504
|
+
let valueTransformed = value * (this.transform || 1);
|
|
2505
|
+
value = this.#formatNumber(value);
|
|
2506
|
+
valueTransformed = this.#formatNumber(valueTransformed);
|
|
2507
|
+
this.value = value;
|
|
2508
|
+
this.input.value = valueTransformed;
|
|
2509
|
+
this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
|
|
2510
|
+
this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
|
|
2513
2511
|
}
|
|
2514
2512
|
#handleMouseDown(e) {
|
|
2515
2513
|
if (this.type !== "number") return;
|
|
2516
|
-
if (e.altKey) {
|
|
2514
|
+
if (e.altKey || e.target.closest("[slot]")) {
|
|
2517
2515
|
this.#isInteracting = true;
|
|
2518
2516
|
this.input.style.cursor =
|
|
2519
2517
|
this.style.cursor =
|
|
2520
2518
|
document.body.style.cursor =
|
|
2521
2519
|
"ew-resize";
|
|
2522
2520
|
this.style.userSelect = "none";
|
|
2523
|
-
// Use the pre-bound handlers
|
|
2524
2521
|
window.addEventListener("pointermove", this.#boundMouseMove);
|
|
2525
2522
|
window.addEventListener("pointerup", this.#boundMouseUp);
|
|
2526
2523
|
}
|
|
@@ -2533,7 +2530,6 @@ class FigInputText extends HTMLElement {
|
|
|
2533
2530
|
document.body.style.cursor =
|
|
2534
2531
|
"";
|
|
2535
2532
|
this.style.userSelect = "all";
|
|
2536
|
-
// Remove the pre-bound handlers
|
|
2537
2533
|
window.removeEventListener("pointermove", this.#boundMouseMove);
|
|
2538
2534
|
window.removeEventListener("pointerup", this.#boundMouseUp);
|
|
2539
2535
|
}
|
|
@@ -2937,28 +2933,25 @@ class FigInputNumber extends HTMLElement {
|
|
|
2937
2933
|
|
|
2938
2934
|
#handleMouseMove(e) {
|
|
2939
2935
|
if (this.disabled) return;
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
|
|
2949
|
-
}
|
|
2936
|
+
let step = (this.step || 1) * e.movementX;
|
|
2937
|
+
let numericValue = this.#getNumericValue(this.input.value);
|
|
2938
|
+
let value = Number(numericValue) / (this.transform || 1) + step;
|
|
2939
|
+
value = this.#sanitizeInput(value, false);
|
|
2940
|
+
this.value = value;
|
|
2941
|
+
this.input.value = this.#formatWithUnit(this.value);
|
|
2942
|
+
this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
|
|
2943
|
+
this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
|
|
2950
2944
|
}
|
|
2951
2945
|
|
|
2952
2946
|
#handleMouseDown(e) {
|
|
2953
2947
|
if (this.disabled) return;
|
|
2954
|
-
if (e.altKey) {
|
|
2948
|
+
if (e.altKey || e.target.closest("[slot]")) {
|
|
2955
2949
|
this.#isInteracting = true;
|
|
2956
2950
|
this.input.style.cursor =
|
|
2957
2951
|
this.style.cursor =
|
|
2958
2952
|
document.body.style.cursor =
|
|
2959
2953
|
"ew-resize";
|
|
2960
2954
|
this.style.userSelect = "none";
|
|
2961
|
-
// Use the pre-bound handlers
|
|
2962
2955
|
window.addEventListener("pointermove", this.#boundMouseMove);
|
|
2963
2956
|
window.addEventListener("pointerup", this.#boundMouseUp);
|
|
2964
2957
|
}
|
|
@@ -2971,7 +2964,6 @@ class FigInputNumber extends HTMLElement {
|
|
|
2971
2964
|
document.body.style.cursor =
|
|
2972
2965
|
"";
|
|
2973
2966
|
this.style.userSelect = "all";
|
|
2974
|
-
// Remove the pre-bound handlers
|
|
2975
2967
|
window.removeEventListener("pointermove", this.#boundMouseMove);
|
|
2976
2968
|
window.removeEventListener("pointerup", this.#boundMouseUp);
|
|
2977
2969
|
}
|
package/package.json
CHANGED