From fadb1a8ac26973fcc8429c0af9c46958fd0a2215 Mon Sep 17 00:00:00 2001 From: yrammos Date: Wed, 12 Nov 2025 22:01:41 +0100 Subject: [PATCH 1/2] Change slur curvature only on mouseup. --- src/js/events/index.js | 8 ++------ src/js/modules/UI/RelationWidth/index.js | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/js/events/index.js b/src/js/events/index.js index e2476e99..efa785ba 100644 --- a/src/js/events/index.js +++ b/src/js/events/index.js @@ -40,7 +40,6 @@ class EventsManager { // fields document.addEventListener('change', this.onChange.bind(this), captureEvent) - document.addEventListener('input', this.onInput.bind(this), captureEvent) document.addEventListener('submit', this.onSubmit.bind(this), captureEvent) // core app events @@ -90,7 +89,8 @@ class EventsManager { } // touchend, mouseup - onTapEnd() { + onTapEnd(e) { + this.app.ui?.relationCurvature?.onTapEnd(e) this.app.ui?.onTapEnd() } @@ -131,10 +131,6 @@ class EventsManager { this.app.ui?.layersMenu?.onChange(e) } - onInput(e) { - this.app.ui?.relationCurvature?.onInput(e) - } - onSubmit(e) { this.app.ui?.relations?.onSubmit(e) this.app.ui?.layersMenu?.jsonTree?.onSubmit(e) diff --git a/src/js/modules/UI/RelationWidth/index.js b/src/js/modules/UI/RelationWidth/index.js index 73ff0e7f..8a5be426 100644 --- a/src/js/modules/UI/RelationWidth/index.js +++ b/src/js/modules/UI/RelationWidth/index.js @@ -14,7 +14,7 @@ class RelationCurvature { this.throttling = false } - onInput({ target }) { + onTapEnd({ target }) { if (target != this.input || this.throttling) { return } From 709b28269621d134b93a733c32a5a06358e55070 Mon Sep 17 00:00:00 2001 From: yrammos Date: Wed, 12 Nov 2025 22:07:48 +0100 Subject: [PATCH 2/2] Update curvature slider on drag. --- src/js/events/index.js | 5 +++++ src/js/modules/UI/RelationWidth/index.js | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/js/events/index.js b/src/js/events/index.js index efa785ba..5e7aa213 100644 --- a/src/js/events/index.js +++ b/src/js/events/index.js @@ -40,6 +40,7 @@ class EventsManager { // fields document.addEventListener('change', this.onChange.bind(this), captureEvent) + document.addEventListener('input', this.onInput.bind(this), captureEvent) document.addEventListener('submit', this.onSubmit.bind(this), captureEvent) // core app events @@ -131,6 +132,10 @@ class EventsManager { this.app.ui?.layersMenu?.onChange(e) } + onInput(e) { + this.app.ui?.relationCurvature?.onInput(e) + } + onSubmit(e) { this.app.ui?.relations?.onSubmit(e) this.app.ui?.layersMenu?.jsonTree?.onSubmit(e) diff --git a/src/js/modules/UI/RelationWidth/index.js b/src/js/modules/UI/RelationWidth/index.js index 8a5be426..551a874d 100644 --- a/src/js/modules/UI/RelationWidth/index.js +++ b/src/js/modules/UI/RelationWidth/index.js @@ -10,24 +10,25 @@ class RelationCurvature { const { min, max, value } = this.input this.progressBar = new Progress('relation-width', { min, max, value }) + } - this.throttling = false + onInput({ target }) { + if (target != this.input) { + return + } + const value = target.value + this.progressBar.update(value) } onTapEnd({ target }) { - if (target != this.input || this.throttling) { + if (target != this.input) { return } - this.throttling = true - - requestAnimationFrame(() => { - const value = target.value - this.progressBar.update(value) - handle_curvature_controller(value) - adjustAllLayersSvgDimensions() - this.throttling = false - }) + const value = target.value + this.progressBar.update(value) + handle_curvature_controller(value) + adjustAllLayersSvgDimensions() } }