minigame 1 lock zoom
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2810,8 +2810,9 @@
|
||||
clearQuizMapPanelThemeInline(panel, textEl);
|
||||
return;
|
||||
}
|
||||
const camX = me.x * tileSize;
|
||||
const camY = me.y * tileSize;
|
||||
const qmCenter = isQuizQuestionMissionHudActivePlay() ? getQuizQuestionMissionMapCenterWorldPxPlay() : null;
|
||||
const camX = qmCenter ? qmCenter.cx : me.x * tileSize;
|
||||
const camY = qmCenter ? qmCenter.cy : me.y * tileSize;
|
||||
const zDom = playDomSyncZoom();
|
||||
const left = (bounds.minX * tileSize - camX) * zDom + canvas.width / 2;
|
||||
const top = (bounds.minY * tileSize - camY) * zDom + canvas.height / 2;
|
||||
@@ -4103,7 +4104,7 @@
|
||||
const viewH = halfH * 2;
|
||||
/*
|
||||
* ถ้ามุมมองกว้าง/สูงกว่าแมป: อย่าใช้ clamp แบบ minCamX (= กล้องชิดซ้ายโลก) — จะดูเหมือนแมปติดมุมซ้ายบน (เด่นใน embed / ซูมออก)
|
||||
* ให้จัดกลางแมปแทน — ต่างจาก mng8a80o ที่กล้องตาม me อยู่แล้ว
|
||||
* ให้จัดกลางแมปแทน — ภารกิจคำถาม mng8a80o ช่วง live ใช้กล้องกลางแมปเหมือนกัน (ดู isQuizQuestionMissionHudActivePlay + draw)
|
||||
*/
|
||||
if (viewW >= mapWpx) px = mapWpx * 0.5;
|
||||
else px = Math.max(minCamX, Math.min(maxCamX, px));
|
||||
@@ -5917,6 +5918,17 @@
|
||||
return isQuizQuestionMissionUiMapPlay() && quizQuestionMissionPhase === 'live';
|
||||
}
|
||||
|
||||
/** ภารกิจคำถาม mng8a80o ช่วง live: กล้องกลางแมป (world px) — ไม่ตาม me */
|
||||
function getQuizQuestionMissionMapCenterWorldPxPlay() {
|
||||
if (!mapData || !isQuiz()) return null;
|
||||
const w = mapData.width || 20;
|
||||
const h = mapData.height || 15;
|
||||
const ts = tileSize;
|
||||
const mwPx = w * ts;
|
||||
const mhPx = h * ts;
|
||||
return { cx: mwPx * 0.5, cy: mhPx * 0.5, mwPx, mhPx };
|
||||
}
|
||||
|
||||
function applyQuizQuestionMissionPanelImages() {
|
||||
const howtoBg = document.querySelector('#gauntlet-crown-howto-overlay .gch-bg');
|
||||
if (howtoBg) {
|
||||
@@ -6002,6 +6014,7 @@
|
||||
quizQuestionMissionCountdownTimer = null;
|
||||
}
|
||||
quizQuestionMissionPhase = 'live';
|
||||
playEmbedUserZoomMul = 1;
|
||||
const qov = document.getElementById('quiz-game-overlay');
|
||||
if (qov) {
|
||||
if (isQuizQuestionMissionUiMapPlay()) qov.classList.add('is-hidden');
|
||||
@@ -14250,6 +14263,7 @@
|
||||
if (!stack) return;
|
||||
const wheelZoomHandler = (e) => {
|
||||
if (!previewMode || !editorEmbedReturn || !mapData) return;
|
||||
if (isQuizQuestionMissionHudActivePlay()) return;
|
||||
const t = e.target;
|
||||
if (t && typeof t.closest === 'function') {
|
||||
if (t.closest('button, input, textarea, select, a[href]')) return;
|
||||
@@ -14273,8 +14287,9 @@
|
||||
const r = canvas.getBoundingClientRect();
|
||||
const sx = e.clientX - r.left;
|
||||
const sy = e.clientY - r.top;
|
||||
const camX = me.x * tileSize;
|
||||
const camY = me.y * tileSize;
|
||||
const qmC = isQuizQuestionMissionHudActivePlay() ? getQuizQuestionMissionMapCenterWorldPxPlay() : null;
|
||||
const camX = qmC ? qmC.cx : me.x * tileSize;
|
||||
const camY = qmC ? qmC.cy : me.y * tileSize;
|
||||
const zHit = lastPlayZDrawForInput > 0 ? lastPlayZDrawForInput : zoom;
|
||||
const gx = (sx - canvas.width / 2) / zHit + camX;
|
||||
const gy = (sy - canvas.height / 2) / zHit + camY;
|
||||
@@ -15909,8 +15924,15 @@
|
||||
camX = mwPx * 0.5;
|
||||
camY = mhPx * 0.5;
|
||||
zDraw = Math.min(canvas.width / mwPx, canvas.height / mhPx) * 0.96;
|
||||
} else if (isQuizQuestionMissionHudActivePlay()) {
|
||||
const qmc = getQuizQuestionMissionMapCenterWorldPxPlay();
|
||||
if (qmc) {
|
||||
camX = qmc.cx;
|
||||
camY = qmc.cy;
|
||||
zDraw = Math.min(canvas.width / qmc.mwPx, canvas.height / qmc.mhPx) * 0.96;
|
||||
}
|
||||
}
|
||||
if (previewMode && editorEmbedReturn && mapData) {
|
||||
if (previewMode && editorEmbedReturn && mapData && !isQuizQuestionMissionHudActivePlay()) {
|
||||
zDraw *= playEmbedUserZoomMul;
|
||||
}
|
||||
const gauntletGroupCam = getGauntletCrownHeistGroupCameraCenterPxPlay(tileSize, canvas.width, canvas.height, zDraw);
|
||||
@@ -16739,7 +16761,7 @@
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (isMovementKey(e.code) && isChatFocused()) return;
|
||||
if (previewMode && editorEmbedReturn && mapData && !isChatFocused()) {
|
||||
if (previewMode && editorEmbedReturn && mapData && !isChatFocused() && !isQuizQuestionMissionHudActivePlay()) {
|
||||
if (e.code === 'BracketLeft' || e.code === 'Minus' || e.code === 'NumpadSubtract') {
|
||||
e.preventDefault();
|
||||
playEmbedUserZoomMul = Math.max(PLAY_EMBED_USER_ZOOM_MIN, playEmbedUserZoomMul / PLAY_EMBED_ZOOM_STEP_KEY);
|
||||
|
||||
@@ -3075,7 +3075,7 @@
|
||||
</div>
|
||||
<script src="/Game/socket.io/socket.io.js"></script>
|
||||
<script src="js/version.js?v=0.0306"></script>
|
||||
<script src="js/play.js?v=0.0330"></script>
|
||||
<script src="js/play.js?v=0.0332"></script>
|
||||
<div class="version-tag">v —</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user