From 7b6df97cd0bbf8a85bdc7841326261384e85d1ac Mon Sep 17 00:00:00 2001 From: "Alexander G. Morano" Date: Sun, 23 Feb 2025 04:04:02 -0500 Subject: [PATCH] * vector fields can now be reset by clicking on the header of the field --- web/widget_vector.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/widget_vector.js b/web/widget_vector.js index a8cbf17..8eaf8b6 100644 --- a/web/widget_vector.js +++ b/web/widget_vector.js @@ -1,6 +1,5 @@ /** * File: widget_vector.js - * Project: Jovi_GLSL */ @@ -164,7 +163,11 @@ const VectorWidget = (app, inputName, options, initial, desc='') => { const index = Math.floor(x / element_width); pointer.onClick = (eUp) => { - if (index >= 0 && index < size) { + /* if click on header, reset to defaults */ + if (index == -1) { + widget.value = Object.assign({}, widget.options.default); + } + else if (index >= 0 && index < size) { const pos = [eUp.canvasX - node.pos[0], eUp.canvasY - node.pos[1]] const old_value = { ...this.value }; const label = this.options?.label ? this.name + '➖' + this.options.label?.[index] : this.name;