From ab0187faacae31f4b03169816f165fa37b5664d9 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Wed, 28 Aug 2024 18:41:58 +0200 Subject: [PATCH] Double click resize lines to reset them to default --- js/interface/interface.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/js/interface/interface.js b/js/interface/interface.js index 027300c6..f4ecf308 100644 --- a/js/interface/interface.js +++ b/js/interface/interface.js @@ -12,6 +12,7 @@ class ResizeLine { this.width = 0; this.get = data.get; this.set = data.set; + this.reset = data.reset; this.node = document.createElement('div'); this.node.className = 'resizer '+(data.horizontal ? 'horizontal' : 'vertical'); this.node.id = 'resizer_'+this.id; @@ -39,6 +40,13 @@ class ResizeLine { document.addEventListener('pointermove', move, false); document.addEventListener('pointerup', stop, false); }) + if (this.reset) { + this.node.addEventListener('dblclick', event => { + this.reset(); + updateInterface(); + this.update(); + }) + } } update() { if (BARS.condition(this.condition)) { @@ -209,6 +217,10 @@ const Interface = { Prop.show_left_bar = true; } }, + reset() { + Interface.getModeData().left_bar_width = Interface.default_data.left_bar_width; + Prop.show_left_bar = true; + }, position() { this.setPosition({ top: 0, @@ -241,6 +253,10 @@ const Interface = { Prop.show_right_bar = true; } }, + reset() { + Interface.getModeData().right_bar_width = Interface.default_data.right_bar_width; + Prop.show_right_bar = true; + }, position() { this.setPosition({ top: 30, @@ -253,6 +269,9 @@ const Interface = { condition() {return Preview.split_screen.enabled && Preview.split_screen.mode != 'double_horizontal'}, get() {return Interface.data.quad_view_x}, set(o, diff) {Interface.data.quad_view_x = limitNumber(o + diff/Interface.preview.clientWidth*100, 5, 95)}, + reset() { + Interface.data.quad_view_x = Interface.default_data.quad_view_x; + }, position() { let p = Interface.preview; if (!p) return; @@ -274,6 +293,9 @@ const Interface = { set(o, diff) { Interface.data.quad_view_y = limitNumber(o + diff/Interface.preview.clientHeight*100, 5, 95) }, + reset() { + Interface.data.quad_view_y = Interface.default_data.quad_view_y; + }, position() { let p = Interface.preview; if (!p) return; @@ -337,6 +359,9 @@ const Interface = { value = Math.snapToValues(value, [Interface.default_data.timeline_head], 12); Interface.data.timeline_head = Timeline.vue._data.head_width = value; }, + reset() { + Interface.data.timeline_head = Interface.default_data.timeline_head; + }, position() { let offset = $(Panels.timeline.vue.$el).offset(); this.setPosition({