mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 00:08:11 +08:00
Improve NumberInput with dragging to change value and escape/right-click to abort (#1469)
* Improve NumberInput with dragging to change value and escape to abort Closes #1468 * Fix slowing with Shift and integer mode
This commit is contained in:
@@ -31,10 +31,10 @@
|
||||
// Called only when `value` is changed from the <input> element via user input and committed, either with the
|
||||
// enter key (via the `change` event) or when the <input> element is unfocused (with the `blur` event binding)
|
||||
function onTextChanged() {
|
||||
// The `unFocus()` call in `onCancelTextChange()` causes itself to be run again, so this if statement skips a second run
|
||||
// The `unFocus()` call in `onTextChangeCanceled()` causes itself to be run again, so this if statement skips a second run
|
||||
if (!editing) return;
|
||||
|
||||
onCancelTextChange();
|
||||
onTextChangeCanceled();
|
||||
|
||||
// TODO: Find a less hacky way to do this
|
||||
if (self) dispatch("commitText", self.getValue());
|
||||
@@ -43,7 +43,7 @@
|
||||
self?.setInputElementValue(self.getValue());
|
||||
}
|
||||
|
||||
function onCancelTextChange() {
|
||||
function onTextChangeCanceled() {
|
||||
editing = false;
|
||||
|
||||
self?.unFocus();
|
||||
@@ -62,7 +62,7 @@
|
||||
on:value
|
||||
on:textFocused={onTextFocused}
|
||||
on:textChanged={onTextChanged}
|
||||
on:cancelTextChange={onCancelTextChange}
|
||||
on:textChangeCanceled={onTextChangeCanceled}
|
||||
spellcheck={true}
|
||||
{label}
|
||||
{disabled}
|
||||
|
||||
Reference in New Issue
Block a user