correct zoom when click on map
Gitea Actions Demo / build_and_push (push) Successful in 3m23s Details

This commit is contained in:
artem 2025-01-24 16:16:11 +03:00
parent c9b0168d14
commit 81a3b3db88
2 changed files with 10 additions and 5 deletions

View File

@ -17,6 +17,9 @@ class LineWithLineController extends LineController {
if (!this.chart.config.plugins) {
return [];
}
if (this.chart.isZoomedOrPanned()) {
return [];
}
for (let i in this.chart.config.plugins) {
if (this.chart.config.plugins[i].id != "yandexMapLine") {
continue
@ -33,13 +36,16 @@ class LineWithLineController extends LineController {
const ctx = this.chart.ctx;
const topY = this.chart.scales.y.top;
const bottomY = this.chart.scales.y.bottom;
// @ts-ignore
let zoom = (this.chart.chartArea.right - this.chart.chartArea.left) / this.chart.config.data.labels.length;
const xVertical = this.getMapX();
for (let i in xVertical) {
// console.log("xVertical", xVertical)
// console.log("ctx", this.chart)
ctx.save();
ctx.beginPath();
ctx.moveTo(xVertical[i], topY);
ctx.lineTo(xVertical[i], bottomY);
ctx.moveTo(xVertical[i] * zoom, topY);
ctx.lineTo(xVertical[i] * zoom, bottomY);
ctx.lineWidth = 3;
ctx.strokeStyle = '#666';
ctx.stroke();

View File

@ -198,7 +198,7 @@ type afterEventEvent = {
type afterEventArgs = {
"event": afterEventEvent,
}
let zoomLine = 1.0;
const chartPlugins = [
{
id: 'eventPlugin',
@ -221,7 +221,6 @@ const chartPlugins = [
isEq = false;
break;
}
console.log(isEq, mapX.value, mapXPrev.value);
if (isEq) {
return;
}