From 2b038c7b72ff3966d0bea38efd9c3de1ded84003 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 Dec 2021 23:52:23 +0100 Subject: [PATCH] Fix issue with exploded skin view in multiple tabs Improve GIF cropping --- css/window.css | 8 ++++---- js/io/formats/skin.js | 5 +++-- js/io/project.js | 1 + js/preview/preview.js | 2 +- js/preview/screenshot.js | 8 ++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/css/window.css b/css/window.css index a5955cbe..5510d8ef 100644 --- a/css/window.css +++ b/css/window.css @@ -1088,10 +1088,10 @@ .gif_recording_frame_handle.gif_resize_nw {cursor: nw-resize} .gif_recording_frame_handle.gif_resize_se {cursor: se-resize} .gif_recording_frame_handle.gif_resize_sw {cursor: sw-resize} - .gif_recording_frame_handle.gif_resize_ne i {transform: rotate(135deg);} - .gif_recording_frame_handle.gif_resize_nw i {transform: rotate(45deg);} - .gif_recording_frame_handle.gif_resize_se i {transform: rotate(225deg);} - .gif_recording_frame_handle.gif_resize_sw i {transform: rotate(-45deg);} + .gif_recording_frame_handle.gif_resize_ne i {transform: rotate(-45deg);} + .gif_recording_frame_handle.gif_resize_nw i {transform: rotate(225deg);} + .gif_recording_frame_handle.gif_resize_se i {transform: rotate(45deg);} + .gif_recording_frame_handle.gif_resize_sw i {transform: rotate(135deg);} /* Amend Edit Menu */ #amend_edit_menu { diff --git a/js/io/formats/skin.js b/js/io/formats/skin.js index 06e9ec5d..af1d9807 100644 --- a/js/io/formats/skin.js +++ b/js/io/formats/skin.js @@ -318,13 +318,14 @@ BARS.defineActions(function() { cube.from.V3_add(center); cube.to.V3_add(center); }) + Project.explode_skin_model = exploded_view; Undo.finishEdit(exploded_view ? 'Explode skin model' : 'Revert exploding skin model', {elements: Cube.all, exploded_view: exploded_view}); Canvas.updateAllPositions(); this.setIcon(this.icon); } }) - Blockbench.on('reset_project', () => { - explode_skin_model.value = false; + Blockbench.on('select_project', () => { + explode_skin_model.value = Project.explode_skin_model; explode_skin_model.updateEnabledState(); }) Blockbench.on('load_undo_save', data => { diff --git a/js/io/project.js b/js/io/project.js index 7b32ad54..ba25851a 100644 --- a/js/io/project.js +++ b/js/io/project.js @@ -25,6 +25,7 @@ class ModelProject { this.mode = 'edit'; this.view_mode = 'textured'; this.display_uv = settings.show_only_selected_uv.value ? 'selected_faces' :'selected_elements'; + this.explode_skin_model = false; this.previews = {}; this.EditSession = null; diff --git a/js/preview/preview.js b/js/preview/preview.js index f823cbe9..551ddd10 100644 --- a/js/preview/preview.js +++ b/js/preview/preview.js @@ -1756,7 +1756,7 @@ class OrbitGizmo { window.addEventListener("gamepadconnected", function(event) { - if (event.gamepad.id.includes('SpaceMouse') || event.gamepad.id.includes('SpaceNavigator')) { + if (event.gamepad.id.includes('SpaceMouse') || event.gamepad.id.includes('SpaceNavigator') || event.gamepad.id.includes('3Dconnexion')) { let interval = setInterval(() => { let gamepad = navigator.getGamepads()[event.gamepad.index]; diff --git a/js/preview/screenshot.js b/js/preview/screenshot.js index 515b1f60..7d472cbe 100644 --- a/js/preview/screenshot.js +++ b/js/preview/screenshot.js @@ -288,10 +288,10 @@ const Screencam = { frame.remove(); } function updateCrop() { - crop.left = Math.clamp(crop.left, 0, preview.width/2 - 12); - crop.right = Math.clamp(crop.right, 0, preview.width/2 - 12); - crop.top = Math.clamp(crop.top, 0, preview.height/2 - 12); - crop.bottom = Math.clamp(crop.bottom, 0, preview.height/2 - 12); + crop.left = Math.clamp(crop.left, 0, preview.width/2 - 20); + crop.right = Math.clamp(crop.right, 0, preview.width/2 - 20); + crop.top = Math.clamp(crop.top, 0, preview.height/2 - 20); + crop.bottom = Math.clamp(crop.bottom, 0, preview.height/2 - 20); frame.style.top = crop.top + 'px'; frame.style.left = crop.left + 'px'; frame.style.right = crop.right + 'px';