mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 19:15:15 +00:00
Freeze pane after first click, require second click to remove.
This commit is contained in:
parent
0af7b02085
commit
06eadcf73a
|
@ -11,13 +11,14 @@ export function usePercentageTool(chartRef, theme: Ref<string>, timeframe_ms: Re
|
||||||
const drawLimitPerSecond = 144;
|
const drawLimitPerSecond = 144;
|
||||||
const canDraw = ref(true);
|
const canDraw = ref(true);
|
||||||
const active = ref(false);
|
const active = ref(false);
|
||||||
|
const closing = ref(false);
|
||||||
|
|
||||||
function roundTF(timestamp: number) {
|
function roundTF(timestamp: number) {
|
||||||
return roundTimeframe(timeframe_ms.value, timestamp, ROUND_CLOSER);
|
return roundTimeframe(timeframe_ms.value, timestamp, ROUND_CLOSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseMove(e: ElementEvent) {
|
function mouseMove(e: ElementEvent) {
|
||||||
if (canDraw.value) draw(e.offsetX, e.offsetY);
|
if (canDraw.value && !closing.value) draw(e.offsetX, e.offsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseDown(e: ElementEvent) {
|
function mouseDown(e: ElementEvent) {
|
||||||
|
@ -33,8 +34,11 @@ export function usePercentageTool(chartRef, theme: Ref<string>, timeframe_ms: Re
|
||||||
|
|
||||||
chartRef.value?.chart.getZr().on('mousemove', mouseMove);
|
chartRef.value?.chart.getZr().on('mousemove', mouseMove);
|
||||||
drawStart();
|
drawStart();
|
||||||
|
} else if (!closing.value) {
|
||||||
|
closing.value = true;
|
||||||
} else {
|
} else {
|
||||||
drawEnd();
|
drawEnd();
|
||||||
|
closing.value = false;
|
||||||
chartRef.value?.chart.getZr().off('mousemove', mouseMove);
|
chartRef.value?.chart.getZr().off('mousemove', mouseMove);
|
||||||
chartRef.value?.chart.getZr().off('mousedown', mouseDown);
|
chartRef.value?.chart.getZr().off('mousedown', mouseDown);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user