From 1cfd9a2e75037a3279537b61f46b5f75f0baeec5 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sat, 21 Sep 2024 21:46:15 +0200 Subject: [PATCH] Disable fox display reference object in bedrock format Fix display panel aligning to the bottom of sidebar --- css/panels.css | 2 +- js/display_mode.js | 10 ++++------ js/interface/panels.js | 9 +++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/css/panels.css b/css/panels.css index fc1d56cd..61bd5538 100644 --- a/css/panels.css +++ b/css/panels.css @@ -111,7 +111,7 @@ .panel.fixed_height { flex-grow: 0; } - .panel.bottommost_panel { + .panel.bottommost_panel:not(.topmost_panel) { margin-top: auto; } diff --git a/js/display_mode.js b/js/display_mode.js index 11868cfd..cf4c4389 100644 --- a/js/display_mode.js +++ b/js/display_mode.js @@ -234,6 +234,7 @@ class refModel { this.name = tl('display.reference.'+id); this.id = id; this.icon = options.icon || id; + this.condition = options.condition; this.initialized = false; this.pose_angles = {}; @@ -1211,7 +1212,7 @@ window.displayReferenceObjects = { armor_stand: new refModel('armor_stand', {icon: 'icon-armor_stand'}), baby_zombie: new refModel('baby_zombie', {icon: 'icon-baby_zombie'}), armor_stand_small: new refModel('armor_stand_small', {icon: 'icon-armor_stand_small'}), - fox: new refModel('fox', {icon: 'pets'}), + fox: new refModel('fox', {icon: 'pets', condition: {formats: ['java_block']}}), monitor: new refModel('monitor', {icon: 'fa-asterisk'}), bow: new refModel('bow', {icon: 'icon-bow'}), crossbow: new refModel('crossbow', {icon: 'icon-crossbow'}), @@ -1227,11 +1228,8 @@ window.displayReferenceObjects = { }, active: '', bar: function(buttons) { - $('#display_ref_bar').html('') - if (buttons.length === 10000) { - this.refmodels[buttons[0]].load() - return; - } + buttons = buttons.filter(id => Condition(this.refmodels[id])); + $('#display_ref_bar').html(''); if (buttons.length < 2) { $('.reference_model_bar').css('visibility', 'hidden') } else { diff --git a/js/interface/panels.js b/js/interface/panels.js index 4b64dc01..dbc12953 100644 --- a/js/interface/panels.js +++ b/js/interface/panels.js @@ -679,6 +679,7 @@ class Panel extends EventSystem { this.node.style.width = this.width + 'px'; this.node.style.height = this.height + 'px'; this.node.classList.remove('bottommost_panel'); + this.node.classList.remove('topmost_panel'); } else { this.node.style.width = this.node.style.height = this.node.style.left = this.node.style.top = null; } @@ -722,6 +723,10 @@ class Panel extends EventSystem { this.node.parentElement?.childNodes.forEach(n => n.classList.remove('bottommost_panel')); this.node.classList.add('bottommost_panel'); } + if ((slot == 'right_bar' && Interface.getRightPanels()[0] == this) || (slot == 'left_bar' && Interface.getLeftPanels()[0] == this)) { + this.node.parentElement?.childNodes.forEach(n => n.classList.remove('topmost_panel')); + this.node.classList.add('topmost_panel'); + } if (Panels[this.id] && this.onResize) this.onResize() } else { @@ -802,8 +807,12 @@ function updateSidebarOrder() { let panel = Panels[panel_id]; if (panel && panel.slot == bar) { panel.node.classList.remove('bottommost_panel'); + panel.node.classList.remove('topmost_panel'); bar_node.append(panel.node); if (Condition(panel.condition)) { + if (panel_count == 0) { + panel.node.classList.add('topmost_panel'); + } panel_count++; last_panel = panel; }