From 7e64a118483445ca3e26d8ca278ac90ef1da78df Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sat, 23 Jan 2021 22:49:21 +0100 Subject: [PATCH] Convert explode skin view action to toggle Fix issue with file input in dialog form --- js/interface/dialog.js | 2 +- js/io/formats/skin.js | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/js/interface/dialog.js b/js/interface/dialog.js index e3fb0b0..751ebe5 100644 --- a/js/interface/dialog.js +++ b/js/interface/dialog.js @@ -166,7 +166,7 @@ function buildForm(dialog) { if (data.type == 'folder' && !isApp) break; var input = $(``); - input[0].value = data.value; + input[0].value = data.value || ''; bar.append(input); bar.addClass('form_bar_file'); diff --git a/js/io/formats/skin.js b/js/io/formats/skin.js index 383adaf..a1b8e55 100644 --- a/js/io/formats/skin.js +++ b/js/io/formats/skin.js @@ -359,14 +359,12 @@ BARS.defineActions(function() { } }) - let exploded_view = false; - let explode_skin_model = new Action('explode_skin_model', { - icon: () => exploded_view ? 'close_fullscreen' : 'open_in_full', + let explode_skin_model = new Toggle('explode_skin_model', { + icon: () => 'open_in_full', category: 'edit', condition: {formats: ['skin']}, - click: function () { - exploded_view = !exploded_view; - + value: false, + onChange(exploded_view) { Undo.initEdit({elements: Cube.all}); Cube.all.forEach(cube => { let center = [ @@ -385,8 +383,8 @@ BARS.defineActions(function() { } }) Blockbench.on('reset_project', () => { - exploded_view = false; - explode_skin_model.setIcon(explode_skin_model.icon) + explode_skin_model.value = false; + explode_skin_model.updateEnabledState(); }) })