Update initialization of skinview3d

This commit is contained in:
printempw 2018-02-23 22:32:08 +08:00
parent 76b607dfd2
commit 0a0b25b5af
7 changed files with 9 additions and 10 deletions

View File

@ -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() {

View File

@ -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]$/, '');

View File

@ -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');

View File

@ -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) {

View File

@ -154,7 +154,6 @@
initSkinViewer(60);
registerAnimationController();
registerWindowResizeHandler();
$.msp.handles.walk.paused = $.msp.handles.rotate.paused = false;
});
</script>
@endsection

View File

@ -98,7 +98,6 @@
initSkinViewer();
registerAnimationController();
registerWindowResizeHandler();
$.msp.handles.walk.paused = $.msp.handles.rotate.paused = false;
});
</script>
@endsection

View File

@ -140,7 +140,6 @@
initSkinViewer();
registerAnimationController();
registerWindowResizeHandler();
$.msp.handles.walk.paused = $.msp.handles.rotate.paused = false;
});
</script>
@endsection