Fix some number input issues

Fix min-max not working for number settings
Change PWA screen orientation
Fix dialog stack issue
Update molang
This commit is contained in:
JannisX11 2022-12-31 01:28:49 +01:00
parent 6062d9cbc8
commit 0896c7dcd9
10 changed files with 24 additions and 19 deletions

View File

@ -83,7 +83,7 @@
}
.empty_dialog {
position: fixed;
z-index: 20;
z-index: 21;
}
dialog > content, dialog .dialog_wrapper > content {
display: block;
@ -100,7 +100,7 @@
.dialog {
position: fixed;
z-index: 20;
z-index: 21;
top: 30px;
}
.dialog:not(.draggable) {

View File

@ -1613,7 +1613,7 @@ Interface.definePanels(() => {
</ul>
<div class="controller_state_input_bar">
<label>${tl('animation_controllers.state.blend_transition')}</label>
<input type="number" class="dark_bordered" style="width: 70px;" v-model="state.blend_transition" min="0" step="0.05">
<input type="number" class="dark_bordered" style="width: 70px;" v-model.number="state.blend_transition" min="0" step="0.05">
</div>
<div class="controller_state_input_bar">
<label :for="state.uuid + '_shortest_path'">${tl('animation_controllers.state.shortest_path')}</label>

View File

@ -745,6 +745,7 @@ window.Dialog = class Dialog {
return this;
}
focus() {
Dialog.stack.remove(this);
let blackout = document.getElementById('blackout');
blackout.style.display = 'block';
blackout.classList.toggle('darken', this.darken);
@ -755,7 +756,6 @@ window.Dialog = class Dialog {
open_dialog = this.id;
open_interface = this;
Dialog.open = this;
Dialog.stack.remove(this);
Dialog.stack.push(this);
}
hide() {
@ -926,7 +926,7 @@ window.MessageBox = class MessageBox extends Dialog {
// Legacy Dialogs
function showDialog(dialog) {
function legacyShowDialog(dialog) { // todo: remove
var obj = $('.dialog#'+dialog)
$('.dialog').hide()
if (open_menu) {
@ -955,11 +955,14 @@ function showDialog(dialog) {
obj.css('max-height', (window.innerHeight-128)+'px')
}
}
function hideDialog() {
function legacyHideDialog() { // todo: remove
$('#blackout').hide()
$('.dialog').hide()
open_dialog = false;
open_interface = false;
Prop.active_panel = undefined
}
function hideDialog() {
console.warn('"hideDialog" is no longer supported!')
}

View File

@ -84,6 +84,7 @@ class Setting {
}
set value(value) {
let profile = Settings.dialog.content_vue?.profile;
if (this.type == 'number') value = Math.clamp(value, this.min, this.max)
if (profile) {
Vue.set(profile.settings, this.id, value);
} else {
@ -807,7 +808,7 @@ onVueSetup(function() {
<div id="settings_profile_wrapper">
Profile:
<bb-select ref="profile_menu" id="settings_profile_select" @click="showProfileMenu($event)" :class="{profile_is_selected: !!profile}">{{ profile_name }}</bb-select>
<div class="tool" @click="profileButtonPress()"><i class="material-icons">{{ profile ? 'settings' : 'add' }}</i></div>
<div class="tool" @click="profileButtonPress()"><i class="material-icons">{{ profile ? 'build' : 'add' }}</i></div>
</div>
<h2 class="i_b">{{ title }}</h2>

View File

@ -143,7 +143,7 @@ async function loadImages(files, event) {
})
} else if (method == 'extrude_with_cubes') {
showDialog('image_extruder');
legacyShowDialog('image_extruder');
Extruder.drawImage(files[0]);
}
}
@ -178,7 +178,7 @@ var Extruder = {
$('#scan_tolerance').on('input', function() {
$('#scan_tolerance_label').text($(this).val())
})
showDialog('image_extruder')
legacyShowDialog('image_extruder')
Extruder.ext_img = new Image()
Extruder.ext_img.src = isApp ? file.path.replace(/#/g, '%23') : file.content
@ -365,7 +365,7 @@ var Extruder = {
Undo.finishEdit('Add extruded texture', {elements: selected, outliner: true, textures: [Texture.all[Texture.all.length-1]]})
hideDialog()
legacyHideDialog()
}
}
//Export
@ -678,7 +678,7 @@ BARS.defineActions(function() {
readtype: 'image'
}, function(files) {
if (files.length) {
showDialog('image_extruder')
legacyShowDialog('image_extruder')
Extruder.drawImage(files[0])
}
})

View File

@ -498,7 +498,7 @@ function getScaleAllGroups() {
}
function scaleAll(save, size) {
if (save === true) {
hideDialog()
legacyHideDialog()
}
if (size === undefined) {
size = $('#model_scale_label').val()
@ -635,7 +635,7 @@ function cancelScaleAll() {
groups: getScaleAllGroups(),
group_aspects: {transform: true},
})
hideDialog()
legacyHideDialog()
}
function setScaleAllPivot(mode) {
if (mode === 'selection') {
@ -1592,7 +1592,7 @@ BARS.defineActions(function() {
getScaleAllGroups().forEach((g) => {
g.old_origin = g.origin.slice();
}, Group, true)
showDialog('scaling')
legacyShowDialog('scaling')
var v = Format.centered_grid ? 0 : 8;
var origin = Group.selected ? Group.selected.origin : [v, 0, v];
$('#scaling_origin_x').val(origin[0])

View File

@ -312,11 +312,11 @@ const PredicateOverrideEditor = {
<select-input v-model="generator.type" :options="available_predicate_options" @input="updateGeneratorType()" />
<label>${tl('dialog.predicate_overrides.variants')}</label>
<input type="number" v-model="generator.variants" class="dark_bordered" min="1" step="1" style="width: 70px;">
<input type="number" v-model.number="generator.variants" class="dark_bordered" min="1" step="1" style="width: 70px;">
<template v-if="generator.type == 'custom_model_data'">
<label>${tl('dialog.predicate_overrides.start_value')}</label>
<input type="number" v-model="generator.start_value" min="0" step="1" class="dark_bordered" style="width: 45px;">
<input type="number" v-model.number="generator.start_value" min="0" step="1" class="dark_bordered" style="width: 45px;">
</template>
<label>${tl('dialog.predicate_overrides.model')}</label>

View File

@ -3,7 +3,7 @@ Prism.languages.molang = {
'function-name': /\b(?!\d)math\.\w+(?=[\t ]*\()/i,
'selector': /\b(?!\d)((query|variable|temp|context|math|q|v|t|c)\.\w+)|this/i,
'boolean': /\b(?:true|false)\b/i,
'number': /(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i,
'number': /(?:\b\d+(?:\.\d+f?)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b/i,
'operator': /&&|\|\||[-+*/!<>]=?|[:?=]/i,
'keyword': /\b(return|loop|for_each|break|continue)\b/i,
'punctuation': /[.,;()[\]{}]/,

File diff suppressed because one or more lines are too long

View File

@ -24,5 +24,6 @@
"background_color": "#21252b",
"theme_color": "#3e90ff",
"display": "standalone",
"display_override": ["tabbed", "minimal-ui"]
"display_override": ["tabbed", "minimal-ui"],
"orientation": "natural"
}