|
84 | 84 | });
|
85 | 85 | saveBtn.addEventListener('click', async function () {
|
86 | 86 | let t = new Date();
|
87 |
| - list.time = `${t.getFullYear()}/${t.getMonth()*1+1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`; |
| 87 | + list.time = `${t.getFullYear()}/${t.getMonth() * 1 + 1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`; |
88 | 88 | let write = await database.ref('/').push(list);
|
89 | 89 | popup.classList.add('show');
|
90 | 90 | let url = `${urlOrigin}${urlPath}#${write.key}`;
|
|
290 | 290 |
|
291 | 291 | // 注意,小車一開始的中心點 y 座標,不等於畫面的中心點 y 座標。
|
292 | 292 | // 邊界在中心的周圍 1/3 小車寬/高的距離
|
293 |
| - const kxCenter = kx + carSize.width/2; // 車子中心點 x 座標 |
294 |
| - const kyCenter = ky + carSize.height/2; // 車子中心點 y 座標 |
295 |
| - const leftSide = ww * 0.5 - carSize.width/3; // 左邊界,小於這個值,判定車子移動到左邊 |
296 |
| - const rightSide = ww * 0.5 + carSize.width/3; // 右邊界,大於這個值,判定車子移動到右邊 |
297 |
| - const topSide = oy + carSize.height/6; // 上邊界,小於這個值,判定車子移動到上面 |
298 |
| - const bottomSide = oy + 5 * carSize.height/6; // 下邊界,小於這個值,判定車子移動到下面 |
| 293 | + const kxCenter = kx + carSize.width / 2; // 車子中心點 x 座標 |
| 294 | + const kyCenter = ky + carSize.height / 2; // 車子中心點 y 座標 |
| 295 | + const leftSide = ww * 0.5 - carSize.width / 3; // 左邊界,小於這個值,判定車子移動到左邊 |
| 296 | + const rightSide = ww * 0.5 + carSize.width / 3; // 右邊界,大於這個值,判定車子移動到右邊 |
| 297 | + const topSide = oy + carSize.height / 6; // 上邊界,小於這個值,判定車子移動到上面 |
| 298 | + const bottomSide = oy + 5 * carSize.height / 6; // 下邊界,小於這個值,判定車子移動到下面 |
299 | 299 |
|
300 | 300 | if (kxCenter < leftSide) {
|
301 | 301 | if (!send.left) {
|
|
378 | 378 | kebbi.addEventListener('touchstart', target);
|
379 | 379 | }
|
380 | 380 |
|
381 |
| - // 處理中間圖片跟隨視窗大小移動位置 |
382 |
| - function screenRotate() { |
383 |
| - const kebbi = document.getElementById('svgKebbi'); |
384 |
| - const circle = document.querySelector('.circle'); |
385 |
| - const ww = content.offsetWidth; |
386 |
| - const wh = content.offsetHeight; |
387 |
| - const ox = (ww - kebbi.offsetWidth) / 2; |
388 |
| - const oy = (wh * 0.8 - kebbi.offsetHeight) / 2; |
389 |
| - kebbi.style.left = `${ox}px`; |
390 |
| - kebbi.style.top = `${oy}px`; |
391 |
| - circle.style.width = `${ww * 0.4}px`; |
392 |
| - circle.style.height = `${ww * 0.4}px`; |
393 |
| - circle.style.left = `${(ww - circle.offsetWidth) / 2}px`; |
394 |
| - circle.style.top = `${(wh * 0.8 - circle.offsetHeight) / 2}px`; |
395 |
| - } |
396 |
| - |
397 |
| - window.addEventListener('resize', screenRotate); |
398 |
| - screenRotate(); |
| 381 | + // 處理中間圖片跟隨視窗大小移動位置 |
| 382 | + window.addEventListener('resize', () => { |
| 383 | + location.reload(); |
| 384 | + }); |
399 | 385 |
|
400 | 386 | }();
|
0 commit comments