Disable display mirroring by default, add setting to enable

Fix issue with settings not updating
Fix issue with upper case characters in settings/keybindings search bar
This commit is contained in:
JannisX11 2022-05-19 22:48:41 +02:00
parent 3ce4390c02
commit c9655c2a91
7 changed files with 51 additions and 20 deletions

View File

@ -355,11 +355,6 @@
.tool:hover { .tool:hover {
color: var(--color-light); color: var(--color-light);
} }
.tool.head_right {
margin-top: -29px;
height: 24px;
float: right;
}
.tool.right_tool { .tool.right_tool {
position: relative; position: relative;
} }

View File

@ -280,9 +280,6 @@
.tabs_small label:hover { .tabs_small label:hover {
color: var(--color-light); color: var(--color-light);
} }
#display_sliders p {
margin-top: 6px;
}
#display_bar .tool, #display_ref_bar > div { #display_bar .tool, #display_ref_bar > div {
width: calc(100% / 8 - 2px); width: calc(100% / 8 - 2px);
max-width: 52px; max-width: 52px;
@ -311,6 +308,15 @@
.tool.display_scale_invert { .tool.display_scale_invert {
position: relative; position: relative;
} }
.bar.display_slot_section_bar {
display: flex;
margin-right: 2px;
margin-top: 2px;
}
.bar.display_slot_section_bar p {
flex-grow: 1;
margin-top: 6px;
}
input#preset_name { input#preset_name {
background-color: var(--color-back); background-color: var(--color-back);

View File

@ -1668,7 +1668,8 @@ Interface.definePanels(function() {
axes: [0, 1, 2], axes: [0, 1, 2],
reference_model: 'player', reference_model: 'player',
pose_angle: 0, pose_angle: 0,
slot: new DisplaySlot() slot: new DisplaySlot(),
allow_mirroring: Settings.get('allow_display_slot_mirror')
}}, }},
watch: { watch: {
pose_angle(value) { pose_angle(value) {
@ -1721,6 +1722,9 @@ Interface.definePanels(function() {
Undo.finishEdit('Change display setting'); Undo.finishEdit('Change display setting');
Interface.removeSuggestedModifierKey('shift', 'modifier_actions.uniform_scaling'); Interface.removeSuggestedModifierKey('shift', 'modifier_actions.uniform_scaling');
}, },
showMirroringSetting() {
Settings.openDialog({search_term: tl('settings.allow_display_slot_mirror')});
},
getAxisLetter getAxisLetter
}, },
template: ` template: `
@ -1756,7 +1760,10 @@ Interface.definePanels(function() {
<div id="display_sliders"> <div id="display_sliders">
<p>${ tl('display.rotation') }</p><div class="tool head_right" v-on:click="resetChannel('rotation')"><i class="material-icons">replay</i></div> <div class="bar display_slot_section_bar">
<p>${ tl('display.rotation') }</p>
<div class="tool head_right" v-on:click="resetChannel('rotation')"><i class="material-icons">replay</i></div>
</div>
<div class="bar slider_input_combo" v-for="axis in axes"> <div class="bar slider_input_combo" v-for="axis in axes">
<input type="range" class="tool disp_range" v-model.number="slot.rotation[axis]" v-bind:trigger_type="'rotation.'+axis" <input type="range" class="tool disp_range" v-model.number="slot.rotation[axis]" v-bind:trigger_type="'rotation.'+axis"
min="-180" max="180" step="1" value="0" min="-180" max="180" step="1" value="0"
@ -1765,7 +1772,10 @@ Interface.definePanels(function() {
<div class="color_corner" :style="{'border-color': \`var(--color-axis-\${getAxisLetter(axis)})\`}"></div> <div class="color_corner" :style="{'border-color': \`var(--color-axis-\${getAxisLetter(axis)})\`}"></div>
</div> </div>
<p>${ tl('display.translation') }</p><div class="tool head_right" v-on:click="resetChannel('translation')"><i class="material-icons">replay</i></div> <div class="bar display_slot_section_bar">
<p>${ tl('display.translation') }</p>
<div class="tool head_right" v-on:click="resetChannel('translation')"><i class="material-icons">replay</i></div>
</div>
<div class="bar slider_input_combo" v-for="axis in axes"> <div class="bar slider_input_combo" v-for="axis in axes">
<input type="range" class="tool disp_range" v-model.number="slot.translation[axis]" v-bind:trigger_type="'translation.'+axis" <input type="range" class="tool disp_range" v-model.number="slot.translation[axis]" v-bind:trigger_type="'translation.'+axis"
v-bind:min="Math.abs(slot.translation[axis]) < 10 ? -20 : (slot.translation[axis] > 0 ? -70*3+10 : -80)" v-bind:min="Math.abs(slot.translation[axis]) < 10 ? -20 : (slot.translation[axis] > 0 ? -70*3+10 : -80)"
@ -1776,9 +1786,13 @@ Interface.definePanels(function() {
<div class="color_corner" :style="{'border-color': \`var(--color-axis-\${getAxisLetter(axis)})\`}"></div> <div class="color_corner" :style="{'border-color': \`var(--color-axis-\${getAxisLetter(axis)})\`}"></div>
</div> </div>
<p>${ tl('display.scale') }</p><div class="tool head_right" v-on:click="resetChannel('scale')"><i class="material-icons">replay</i></div> <div class="bar display_slot_section_bar">
<p>${ tl('display.scale') }</p>
<div class="tool head_right" v-on:click="showMirroringSetting()"><i class="material-icons">flip</i></div>
<div class="tool head_right" v-on:click="resetChannel('scale')"><i class="material-icons">replay</i></div>
</div>
<div class="bar slider_input_combo" v-for="axis in axes"> <div class="bar slider_input_combo" v-for="axis in axes">
<div class="tool display_scale_invert" v-on:click="invert(axis)"> <div class="tool display_scale_invert" v-on:click="invert(axis)" v-if="allow_mirroring">
<div class="tooltip">${ tl('display.mirror') }</div> <div class="tooltip">${ tl('display.mirror') }</div>
<i class="material-icons">{{ slot.mirror[axis] ? 'check_box' : 'check_box_outline_blank' }}</i> <i class="material-icons">{{ slot.mirror[axis] ? 'check_box' : 'check_box_outline_blank' }}</i>
</div> </div>
@ -1792,7 +1806,9 @@ Interface.definePanels(function() {
</div> </div>
<template v-if="reference_model == 'player'"> <template v-if="reference_model == 'player'">
<div class="bar display_slot_section_bar">
<p>${ tl('display.pose_angle') }</p> <p>${ tl('display.pose_angle') }</p>
</div>
<div class="bar slider_input_combo"> <div class="bar slider_input_combo">
<input type="range" class="tool disp_range" v-model.number="pose_angle" <input type="range" class="tool disp_range" v-model.number="pose_angle"
min="-180" max="180" step="1" value="0"> min="-180" max="180" step="1" value="0">

View File

@ -492,7 +492,7 @@ onVueSetup(function() {
computed: { computed: {
list() { list() {
if (this.search_term) { if (this.search_term) {
var keywords = this.search_term.replace(/_/g, ' ').split(' '); var keywords = this.search_term.toLowerCase().replace(/_/g, ' ').split(' ');
var actions = []; var actions = [];
for (var action of Keybinds.actions) { for (var action of Keybinds.actions) {

View File

@ -248,6 +248,9 @@ const Settings = {
new Setting('highlight_cubes', {category: 'edit', value: true, onChange() { new Setting('highlight_cubes', {category: 'edit', value: true, onChange() {
updateCubeHighlights(); updateCubeHighlights();
}}); }});
new Setting('allow_display_slot_mirror', {category: 'edit', value: false, onChange(value) {
DisplayMode.vue.allow_mirroring = value;
}})
new Setting('deactivate_size_limit',{category: 'edit', value: false}); new Setting('deactivate_size_limit',{category: 'edit', value: false});
new Setting('vertex_merge_distance',{category: 'edit', value: 0.1, step: 0.01, type: 'number'}); new Setting('vertex_merge_distance',{category: 'edit', value: 0.1, step: 0.01, type: 'number'});
new Setting('preview_paste_behavior',{category: 'edit', value: 'always_ask', type: 'select', options: { new Setting('preview_paste_behavior',{category: 'edit', value: 'always_ask', type: 'select', options: {
@ -384,7 +387,7 @@ const Settings = {
} }
for (var id in settings) { for (var id in settings) {
var setting = settings[id]; var setting = settings[id];
if (!Condition(setting.condition)) return; if (!Condition(setting.condition)) continue;
if (setting.onChange && hasSettingChanged(id)) { if (setting.onChange && hasSettingChanged(id)) {
setting.onChange(setting.value); setting.onChange(setting.value);
} }
@ -408,6 +411,15 @@ const Settings = {
return settings[id].value; return settings[id].value;
} }
}, },
openDialog(options = {}) {
for (var sett in settings) {
if (settings.hasOwnProperty(sett)) {
Settings.old[sett] = settings[sett].value
}
}
Settings.dialog.show();
if (options.search_term) Settings.dialog.content_vue.search_term = options.search_term;
},
old: {} old: {}
} }
Settings.setup() Settings.setup()
@ -422,7 +434,7 @@ function updateStreamerModeNotification() {
text_color: 'var(--color-light)', text_color: 'var(--color-light)',
text: [ text: [
{type: 'h1', text: tl('interface.streamer_mode_on'), click() { {type: 'h1', text: tl('interface.streamer_mode_on'), click() {
ActionControl.select(`setting: ${tl('settings.streamer_mode')}`); Settings.openDialog({search_term: tl('settings.streamer_mode')})
}} }}
] ]
}) })
@ -558,7 +570,7 @@ onVueSetup(function() {
computed: { computed: {
list() { list() {
if (this.search_term) { if (this.search_term) {
var keywords = this.search_term.replace(/_/g, ' ').split(' '); var keywords = this.search_term.toLowerCase().replace(/_/g, ' ').split(' ');
var items = {}; var items = {};
for (var key in settings) { for (var key in settings) {
var setting = settings[key]; var setting = settings[key];

File diff suppressed because one or more lines are too long

View File

@ -691,6 +691,8 @@
"settings.highlight_cubes.desc": "Highlight cubes when you hover over them or select them", "settings.highlight_cubes.desc": "Highlight cubes when you hover over them or select them",
"settings.deactivate_size_limit": "Deactivate Size Limit", "settings.deactivate_size_limit": "Deactivate Size Limit",
"settings.deactivate_size_limit.desc": "Deactivate the size limit for specific model formats. WARNING: This can cause invalid models.", "settings.deactivate_size_limit.desc": "Deactivate the size limit for specific model formats. WARNING: This can cause invalid models.",
"settings.allow_display_slot_mirror": "Allow Display Slot Mirroring",
"settings.allow_display_slot_mirror.desc": "Allow Display slots for Java item models to be mirrored. WARNING: This only works in Minecraft 1.14 or earlier or in special cases.",
"settings.vertex_merge_distance": "Vertex Merge Distance", "settings.vertex_merge_distance": "Vertex Merge Distance",
"settings.vertex_merge_distance.desc": "Distance within which vertices are merged using merging by distance", "settings.vertex_merge_distance.desc": "Distance within which vertices are merged using merging by distance",
"settings.preview_paste_behavior": "Default Preview Paste Behavior", "settings.preview_paste_behavior": "Default Preview Paste Behavior",