From 315d5dbe74cb5c3ab153f7358751d92d014ced57 Mon Sep 17 00:00:00 2001 From: Jin-Hee Park <53548023+jhee564@users.noreply.github.com> Date: Mon, 3 Jan 2022 09:58:27 +0900 Subject: [PATCH] =?UTF-8?q?[#997][3.0]=20Scatter=20Chart=20>=20Drag=20?= =?UTF-8?q?=EB=B2=94=EC=9C=84=20=EC=A1=B0=EC=A0=95=20(#998)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jinhee park --- .../chart/plugins/plugins.interaction.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/chart/plugins/plugins.interaction.js b/src/components/chart/plugins/plugins.interaction.js index abcc98eda..8d2fec657 100644 --- a/src/components/chart/plugins/plugins.interaction.js +++ b/src/components/chart/plugins/plugins.interaction.js @@ -175,7 +175,7 @@ const modules = { * @returns {undefined} */ dragStart(evt, type) { - const [offsetX, offsetY] = this.getMousePosition(evt); + let [offsetX, offsetY] = this.getMousePosition(evt); const chartRect = this.chartRect; const labelOffset = this.labelOffset; const range = { @@ -185,11 +185,20 @@ const modules = { y2: chartRect.y2 - labelOffset.bottom, }; - // check graph range - if (offsetX < range.x1 || offsetX > range.x2 - || offsetY < range.y1 || offsetY > range.y2 - ) { - return; + if (offsetX < range.x1) { + offsetX = range.x1; + } + + if (offsetX > range.x2) { + offsetX = range.x2; + } + + if (offsetY < range.y1) { + offsetY = range.y1; + } + + if (offsetY > range.y2) { + offsetY = range.y2; } this.dragInfo = {