修复行情区 15m 周期快捷键与全屏 F 键
- 数字 1 不再立即切 1m,支持连按 15/1440/10080 - 新增 F 键全屏,捕获阶段监听 Ctrl+空格 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -701,10 +701,16 @@
|
||||
function canExtendTfDigitBuffer(buf) {
|
||||
if (!buf) return false;
|
||||
return TF_MINUTE_KEYS.some(function (k) {
|
||||
return k.indexOf(buf) === 0;
|
||||
return k.length > buf.length && k.indexOf(buf) === 0;
|
||||
});
|
||||
}
|
||||
|
||||
function shouldCommitTfBufferNow(buf) {
|
||||
const tf = resolveTfFromDigitBuffer(buf);
|
||||
if (!tf) return false;
|
||||
return !canExtendTfDigitBuffer(buf);
|
||||
}
|
||||
|
||||
function resolveTfFromDigitBuffer(buf) {
|
||||
if (!buf) return null;
|
||||
return TF_BY_MINUTES[buf] || null;
|
||||
@@ -774,15 +780,13 @@
|
||||
tfDigitBuf = "";
|
||||
}
|
||||
tfDigitBuf += digit;
|
||||
const immediate = resolveTfFromDigitBuffer(tfDigitBuf);
|
||||
if (immediate) {
|
||||
if (shouldCommitTfBufferNow(tfDigitBuf)) {
|
||||
commitTfDigitBuffer();
|
||||
return;
|
||||
}
|
||||
if (!canExtendTfDigitBuffer(tfDigitBuf)) {
|
||||
tfDigitBuf = digit;
|
||||
const again = resolveTfFromDigitBuffer(tfDigitBuf);
|
||||
if (again) {
|
||||
if (shouldCommitTfBufferNow(tfDigitBuf)) {
|
||||
commitTfDigitBuffer();
|
||||
return;
|
||||
}
|
||||
@@ -791,14 +795,13 @@
|
||||
tfDigitTimer = setTimeout(commitTfDigitBuffer, TF_DIGIT_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
function isFullscreenShortcut(e) {
|
||||
return (
|
||||
e.ctrlKey &&
|
||||
!e.altKey &&
|
||||
!e.metaKey &&
|
||||
!e.shiftKey &&
|
||||
(e.code === "Space" || e.key === " " || e.key === "Spacebar")
|
||||
);
|
||||
function isChartFullscreenShortcut(e) {
|
||||
if (e.altKey || e.metaKey) return false;
|
||||
const isSpace =
|
||||
e.code === "Space" || e.key === " " || e.key === "Spacebar";
|
||||
if (isSpace && e.ctrlKey) return true;
|
||||
if ((e.key === "f" || e.key === "F") && !e.ctrlKey && !e.shiftKey) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function onMarketKeydown(e) {
|
||||
@@ -806,12 +809,15 @@
|
||||
|
||||
if (e.key === "Escape" && chartFullscreen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setChartFullscreen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFullscreenShortcut(e)) {
|
||||
if (isChartFullscreenShortcut(e)) {
|
||||
if (isTypingInField(e.target) && (e.key === "f" || e.key === "F")) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
toggleChartFullscreen();
|
||||
return;
|
||||
}
|
||||
@@ -1597,7 +1603,7 @@
|
||||
updateIndicators();
|
||||
});
|
||||
});
|
||||
document.addEventListener("keydown", onMarketKeydown);
|
||||
window.addEventListener("keydown", onMarketKeydown, true);
|
||||
if (elFsExchange) {
|
||||
elFsExchange.addEventListener("change", function () {
|
||||
syncMainFromFsToolbar();
|
||||
|
||||
Reference in New Issue
Block a user