Skip to content

Commit

Permalink
[#997][3.0] Scatter Chart > Drag 범위 조정 (#998)
Browse files Browse the repository at this point in the history
Co-authored-by: jinhee park <jinhee@ex-em.com>
  • Loading branch information
jhee564 and jhee564 authored Jan 3, 2022
1 parent a9d5c8c commit 315d5db
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/components/chart/plugins/plugins.interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down

0 comments on commit 315d5db

Please sign in to comment.