mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 06:38:12 +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:
@@ -21,10 +21,10 @@
|
||||
// Called only when `value` is changed from the <textarea> element via user input and committed, either
|
||||
// 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());
|
||||
@@ -33,7 +33,7 @@
|
||||
self?.setInputElementValue(self.getValue());
|
||||
}
|
||||
|
||||
function onCancelTextChange() {
|
||||
function onTextChangeCanceled() {
|
||||
editing = false;
|
||||
|
||||
self?.unFocus();
|
||||
@@ -51,7 +51,7 @@
|
||||
on:value
|
||||
on:textFocused={onTextFocused}
|
||||
on:textChanged={onTextChanged}
|
||||
on:cancelTextChange={onCancelTextChange}
|
||||
on:textChangeCanceled={onTextChangeCanceled}
|
||||
textarea={true}
|
||||
spellcheck={true}
|
||||
{label}
|
||||
|
||||
Reference in New Issue
Block a user