mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Add the Channel Mixer node (#1142)
* Add the Channel Mixer node * Fix NodeIdentifier not found in Registry * Add radio toggle for red/green/blue --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -336,12 +336,12 @@
|
||||
}
|
||||
|
||||
function doubleClick(e: MouseEvent) {
|
||||
const node = (e.target as HTMLElement).closest("[data-node]") as HTMLElement | undefined;
|
||||
const nodeId = node?.getAttribute("data-node") || undefined;
|
||||
if (nodeId) {
|
||||
const id = BigInt(nodeId);
|
||||
editor.instance.doubleClickNode(id);
|
||||
}
|
||||
// const node = (e.target as HTMLElement).closest("[data-node]") as HTMLElement | undefined;
|
||||
// const nodeId = node?.getAttribute("data-node") || undefined;
|
||||
// if (nodeId) {
|
||||
// const id = BigInt(nodeId);
|
||||
// editor.instance.doubleClickNode(id);
|
||||
// }
|
||||
}
|
||||
|
||||
function pointerMove(e: PointerEvent) {
|
||||
|
||||
@@ -174,6 +174,9 @@
|
||||
function onCancelTextChange() {
|
||||
updateValue(undefined, min, max, displayDecimalPlaces, unit);
|
||||
|
||||
rangeSliderValue = value;
|
||||
rangeSliderValueAsRendered = value;
|
||||
|
||||
editing = false;
|
||||
|
||||
self?.unFocus();
|
||||
@@ -203,11 +206,16 @@
|
||||
|
||||
function updateValue(newValue: number | undefined, min: number | undefined, max: number | undefined, displayDecimalPlaces: number, unit: string) {
|
||||
// Check if the new value is valid, otherwise we use the old value (rounded if it's an integer)
|
||||
const nowValid = value !== undefined && isInteger ? Math.round(value) : value;
|
||||
let cleaned = newValue !== undefined ? newValue : nowValid;
|
||||
const oldValue = value !== undefined && isInteger ? Math.round(value) : value;
|
||||
let cleaned = newValue !== undefined ? newValue : oldValue;
|
||||
|
||||
if (typeof min === "number" && !Number.isNaN(min) && cleaned !== undefined) cleaned = Math.max(cleaned, min);
|
||||
if (typeof max === "number" && !Number.isNaN(max) && cleaned !== undefined) cleaned = Math.min(cleaned, max);
|
||||
if (cleaned !== undefined) {
|
||||
if (typeof min === "number" && !Number.isNaN(min)) cleaned = Math.max(cleaned, min);
|
||||
if (typeof max === "number" && !Number.isNaN(max)) cleaned = Math.min(cleaned, max);
|
||||
|
||||
rangeSliderValue = cleaned;
|
||||
rangeSliderValueAsRendered = cleaned;
|
||||
}
|
||||
|
||||
text = displayText(cleaned, displayDecimalPlaces, unit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user