Skip to content

Commit c0f6318

Browse files
author
Toni Brown
authored
Fix followPointer (#193)
1 parent 8883dab commit c0f6318

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

build/cubism2/LAppModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ class LAppModel extends L2DBaseModel {
231231
}
232232
}
233233
setExpression(name) {
234-
var _b;
234+
var _a;
235235
const motion = this.expressions[name];
236236
logger.trace('Expression : ' + name);
237-
(_b = this.expressionManager) === null || _b === void 0 ? void 0 : _b.startMotion(motion, false);
237+
(_a = this.expressionManager) === null || _a === void 0 ? void 0 : _a.startMotion(motion, false);
238238
}
239239
draw(gl) {
240240
MatrixStack.push();

build/cubism2/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class Cubism2Model {
174174
}
175175
}
176176
modelTurnHead(event) {
177-
var _b;
177+
var _a;
178178
const rect = this.canvas.getBoundingClientRect();
179179
const { vx, vy } = normalizePoint(event.clientX, event.clientY, rect.left + rect.width / 2, rect.top + rect.height / 2, window.innerWidth, window.innerHeight);
180180
logger.trace('onMouseDown device( x:' +
@@ -188,13 +188,13 @@ class Cubism2Model {
188188
')');
189189
this.dragMgr.setPoint(vx, vy);
190190
this.live2DMgr.tapEvent(vx, vy);
191-
if ((_b = this.live2DMgr) === null || _b === void 0 ? void 0 : _b.model.hitTest(LAppDefine.HIT_AREA_BODY, vx, vy)) {
191+
if ((_a = this.live2DMgr) === null || _a === void 0 ? void 0 : _a.model.hitTest(LAppDefine.HIT_AREA_BODY, vx, vy)) {
192192
window.dispatchEvent(new Event('live2d:tapbody'));
193193
}
194194
}
195195
followPointer(event) {
196-
var _b;
197-
const rect = event.target.getBoundingClientRect();
196+
var _a;
197+
const rect = this.canvas.getBoundingClientRect();
198198
const { vx, vy } = normalizePoint(event.clientX, event.clientY, rect.left + rect.width / 2, rect.top + rect.height / 2, window.innerWidth, window.innerHeight);
199199
logger.trace('onMouseMove device( x:' +
200200
event.clientX +
@@ -206,7 +206,7 @@ class Cubism2Model {
206206
vy +
207207
')');
208208
this.dragMgr.setPoint(vx, vy);
209-
if ((_b = this.live2DMgr) === null || _b === void 0 ? void 0 : _b.model.hitTest(LAppDefine.HIT_AREA_BODY, vx, vy)) {
209+
if ((_a = this.live2DMgr) === null || _a === void 0 ? void 0 : _a.model.hitTest(LAppDefine.HIT_AREA_BODY, vx, vy)) {
210210
window.dispatchEvent(new Event('live2d:hoverbody'));
211211
}
212212
}

build/message.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function welcomeMessage(time, welcomeTemplate, referrerTemplate) {
4444
}
4545
function i18n(template, ...args) {
4646
return template.replace(/\$(\d+)/g, (_, idx) => {
47-
var _b;
47+
var _a;
4848
const i = parseInt(idx, 10) - 1;
49-
return (_b = args[i]) !== null && _b !== void 0 ? _b : '';
49+
return (_a = args[i]) !== null && _a !== void 0 ? _a : '';
5050
});
5151
}
5252
export { showMessage, welcomeMessage, i18n };

build/model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { loadExternalResource, randomOtherOption } from './utils.js';
1212
import logger from './logger.js';
1313
class ModelManager {
1414
constructor(config, models = []) {
15-
var _b;
15+
var _a;
1616
this.modelList = null;
1717
let { apiPath, cdnPath } = config;
1818
const { cubism2Path, cubism5Path } = config;
@@ -38,7 +38,7 @@ class ModelManager {
3838
modelTexturesId = 0;
3939
}
4040
if (isNaN(modelId)) {
41-
modelId = (_b = config.modelId) !== null && _b !== void 0 ? _b : 0;
41+
modelId = (_a = config.modelId) !== null && _a !== void 0 ? _a : 0;
4242
}
4343
this.useCDN = useCDN;
4444
this.cdnPath = cdnPath || '';
@@ -117,7 +117,7 @@ class ModelManager {
117117
const response = yield fetch(url);
118118
result = yield response.json();
119119
}
120-
catch (_b) {
120+
catch (_a) {
121121
result = null;
122122
}
123123
this.modelJSONCache[url] = result;

build/tools.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ToolsManager {
101101
};
102102
}
103103
registerTools() {
104-
var _b;
104+
var _a;
105105
if (!Array.isArray(this.config.tools)) {
106106
this.config.tools = Object.keys(this.tools);
107107
}
@@ -111,8 +111,8 @@ class ToolsManager {
111111
const element = document.createElement('span');
112112
element.id = `waifu-tool-${toolName}`;
113113
element.innerHTML = icon;
114-
(_b = document
115-
.getElementById('waifu-tool')) === null || _b === void 0 ? void 0 : _b.insertAdjacentElement('beforeend', element);
114+
(_a = document
115+
.getElementById('waifu-tool')) === null || _a === void 0 ? void 0 : _a.insertAdjacentElement('beforeend', element);
116116
element.addEventListener('click', callback);
117117
}
118118
}

build/widget.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function registerEventListener(tips) {
4545
}
4646
}, 1000);
4747
window.addEventListener('mouseover', (event) => {
48-
var _b;
48+
var _a;
4949
for (let { selector, text } of tips.mouseover) {
50-
if (!((_b = event.target) === null || _b === void 0 ? void 0 : _b.closest(selector)))
50+
if (!((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest(selector)))
5151
continue;
5252
if (lastHoverElement === selector)
5353
return;
@@ -59,9 +59,9 @@ function registerEventListener(tips) {
5959
}
6060
});
6161
window.addEventListener('click', (event) => {
62-
var _b;
62+
var _a;
6363
for (let { selector, text } of tips.click) {
64-
if (!((_b = event.target) === null || _b === void 0 ? void 0 : _b.closest(selector)))
64+
if (!((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest(selector)))
6565
continue;
6666
text = randomSelection(text);
6767
text = text.replace('{text}', event.target.innerText);
@@ -92,7 +92,7 @@ function registerEventListener(tips) {
9292
}
9393
function loadWidget(config) {
9494
return __awaiter(this, void 0, void 0, function* () {
95-
var _b;
95+
var _a;
9696
localStorage.removeItem('waifu-display');
9797
sessionStorage.removeItem('waifu-message-priority');
9898
document.body.insertAdjacentHTML('beforeend', `<div id="waifu">
@@ -116,7 +116,7 @@ function loadWidget(config) {
116116
new ToolsManager(model, config, tips).registerTools();
117117
if (config.drag)
118118
registerDrag();
119-
(_b = document.getElementById('waifu')) === null || _b === void 0 ? void 0 : _b.classList.add('waifu-active');
119+
(_a = document.getElementById('waifu')) === null || _a === void 0 ? void 0 : _a.classList.add('waifu-active');
120120
});
121121
}
122122
function initWidget(config) {
@@ -130,18 +130,18 @@ function initWidget(config) {
130130
</div>`);
131131
const toggle = document.getElementById('waifu-toggle');
132132
toggle === null || toggle === void 0 ? void 0 : toggle.addEventListener('click', () => {
133-
var _b;
133+
var _a;
134134
toggle === null || toggle === void 0 ? void 0 : toggle.classList.remove('waifu-toggle-active');
135135
if (toggle === null || toggle === void 0 ? void 0 : toggle.getAttribute('first-time')) {
136136
loadWidget(config);
137137
toggle === null || toggle === void 0 ? void 0 : toggle.removeAttribute('first-time');
138138
}
139139
else {
140140
localStorage.removeItem('waifu-display');
141-
(_b = document.getElementById('waifu')) === null || _b === void 0 ? void 0 : _b.classList.remove('waifu-hidden');
141+
(_a = document.getElementById('waifu')) === null || _a === void 0 ? void 0 : _a.classList.remove('waifu-hidden');
142142
setTimeout(() => {
143-
var _b;
144-
(_b = document.getElementById('waifu')) === null || _b === void 0 ? void 0 : _b.classList.add('waifu-active');
143+
var _a;
144+
(_a = document.getElementById('waifu')) === null || _a === void 0 ? void 0 : _a.classList.add('waifu-active');
145145
}, 0);
146146
}
147147
});

dist/chunk/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chunk/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chunk/index2.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chunk/index2.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)