diff --git a/resources/assets/src/js/common/skinview3d.js b/resources/assets/src/js/common/skinview3d.js index 82dd3ca5..e4770763 100644 --- a/resources/assets/src/js/common/skinview3d.js +++ b/resources/assets/src/js/common/skinview3d.js @@ -24,7 +24,7 @@ function initSkinViewer(cameraPositionZ = 70) { $.msp.handles.walk = $.msp.viewer.animation.add(skinview3d.WalkingAnimation); $.msp.handles.run = $.msp.viewer.animation.add(skinview3d.RunningAnimation); $.msp.handles.rotate = $.msp.viewer.animation.add(skinview3d.RotatingAnimation); - $.msp.handles.walk.paused = $.msp.handles.run.paused = $.msp.handles.rotate.paused = true; + $.msp.handles.run.paused = true; $.msp.control = skinview3d.createOrbitControls($.msp.viewer); } @@ -57,7 +57,14 @@ function registerAnimationController() { }); $('.fa-repeat').click(() => ($.msp.handles.rotate.paused = !$.msp.handles.rotate.paused)); - $('.fa-stop').click(() => initSkinViewer()); + $('.fa-stop').click(() => { + initSkinViewer(); + + // Pause all animations respectively + for (const key in $.msp.handles) { + $.msp.handles[key].paused = true; + } + }); } function registerWindowResizeHandler() { diff --git a/resources/assets/src/js/skinlib/upload.js b/resources/assets/src/js/skinlib/upload.js index 2a307afb..41a30146 100644 --- a/resources/assets/src/js/skinlib/upload.js +++ b/resources/assets/src/js/skinlib/upload.js @@ -23,7 +23,6 @@ function initUploadListeners() { $.msp.config.skinUrl = defaultSkin; initSkinViewer(); $('[for="private"]').tooltip(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; }); } @@ -69,8 +68,6 @@ function handleFiles(files, type) { initSkinViewer(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; - if ($name.val() === '' || $name.val() === $name.attr('data-last-file-name')) { // Remove png extension in filename const fileName = file.name.replace(/\.[Pp][Nn][Gg]$/, ''); diff --git a/resources/assets/src/js/user/closet.js b/resources/assets/src/js/user/closet.js index f894b2ba..12666077 100644 --- a/resources/assets/src/js/user/closet.js +++ b/resources/assets/src/js/user/closet.js @@ -32,7 +32,6 @@ $('body').on('click', '.item-body', async function () { // Reset skinview3d to change model $.msp.config.slim = (type === 'alex'); initSkinViewer(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; } const skin = $indicator.data('skin'); diff --git a/resources/assets/src/js/user/player.js b/resources/assets/src/js/user/player.js index 2eddf8dd..01f38ace 100644 --- a/resources/assets/src/js/user/player.js +++ b/resources/assets/src/js/user/player.js @@ -85,7 +85,6 @@ async function showPlayerTexturePreview(pid) { if (shouldBeUpdated) { initSkinViewer(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; console.log(`[skinview3d] texture previews of player ${result.player_name} rendered`); } } catch (error) { diff --git a/resources/views/skinlib/show.tpl b/resources/views/skinlib/show.tpl index 06f59148..94e0fe4d 100644 --- a/resources/views/skinlib/show.tpl +++ b/resources/views/skinlib/show.tpl @@ -154,7 +154,6 @@ initSkinViewer(60); registerAnimationController(); registerWindowResizeHandler(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; }); @endsection diff --git a/resources/views/user/closet.tpl b/resources/views/user/closet.tpl index 1529e95d..10d2ae14 100644 --- a/resources/views/user/closet.tpl +++ b/resources/views/user/closet.tpl @@ -98,7 +98,6 @@ initSkinViewer(); registerAnimationController(); registerWindowResizeHandler(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; }); @endsection diff --git a/resources/views/user/player.tpl b/resources/views/user/player.tpl index 92c52391..0865b7e3 100644 --- a/resources/views/user/player.tpl +++ b/resources/views/user/player.tpl @@ -140,7 +140,6 @@ initSkinViewer(); registerAnimationController(); registerWindowResizeHandler(); - $.msp.handles.walk.paused = $.msp.handles.rotate.paused = false; }); @endsection