Avoid operating skinViewer instance directly outside the module

This commit is contained in:
printempw 2018-02-24 00:08:00 +08:00
parent 0373c0ada6
commit 249c9f290d

View File

@ -1,4 +1,4 @@
/* global initSkinViewer */
/* global initSkinViewer, applySkinViewerConfig */
'use strict';
@ -21,10 +21,10 @@ $('body').on('click', '.item-body', async function () {
});
if (type === 'cape') {
$.msp.viewer.capeUrl = $.msp.config.capeUrl = url(`textures/${hash}`);
$.msp.config.capeUrl = url(`textures/${hash}`);
$indicator.data('cape', tid);
} else {
$.msp.viewer.skinUrl = $.msp.config.skinUrl = url(`textures/${hash}`);
$.msp.config.skinUrl = url(`textures/${hash}`);
$indicator.data('skin', tid);
}
@ -32,6 +32,8 @@ $('body').on('click', '.item-body', async function () {
// Reset skinview3d to change model
$.msp.config.slim = (type === 'alex');
initSkinViewer();
} else {
applySkinViewerConfig();
}
const skin = $indicator.data('skin');