Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
fix dialog style load
Browse files Browse the repository at this point in the history
  • Loading branch information
journey-ad authored and EYHN committed Dec 1, 2019
1 parent 22f3ee3 commit e380f58
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { tapbodyEmitter } from './emitter/tapbody';
import { tapfaceEmitter } from './emitter/tapface';
import { hitokotoVariable } from './variable/hitokoto';

document.head.innerHTML += `
<style>
const dialogStyle = document.createElement('style');
dialogStyle.innerHTML = `
.live2d-widget-dialog-container {
width: 300px;
height: 120px;
Expand Down Expand Up @@ -39,9 +39,8 @@ document.head.innerHTML += `
@keyframes live2d-widget-dialog-tingle {
0% { transform: translate(-1px, 1.5px) rotate(-2deg); }
100% { transform: translate(1px, -1.5px) rotate(2deg); }
}
</style>
`;
}`;
document.head.appendChild(dialogStyle);

let containerElement,dialogElement,closeTimer;

Expand All @@ -52,7 +51,7 @@ let containerElement,dialogElement,closeTimer;
function createDialogElement(root) {
containerElement = document.createElement('div');
containerElement.className = 'live2d-widget-dialog-container';
containerElement.style.transform = `scale(${config.display.width / 250})`
containerElement.style.transform = `scale(${config.display.width / 250})`;
dialogElement = document.createElement('div');
dialogElement.className = 'live2d-widget-dialog';
containerElement.appendChild(dialogElement);
Expand All @@ -70,7 +69,7 @@ function createDialogElement(root) {
scriptEngine.registerVariable('hitokoto', hitokotoVariable);
Object.keys(config.dialog.script).forEach(key => {
scriptEngine.run(key, config.dialog.script[key]);
})
});
}
}

Expand All @@ -93,4 +92,4 @@ function alertText(text) {

module.exports = {
createDialogElement, displayDialog, hiddenDialog, alertText
}
};

0 comments on commit e380f58

Please sign in to comment.