Skip to content

Commit

Permalink
[#1045] Chart > drag-select 이벤트 선택 영역 사이즈 관련 이슈
Browse files Browse the repository at this point in the history
###################################
1. drag 영역의 너비 및 높이가 1이상일 경우에만 drag-select 이벤트가 발생되도록 조건 추가
2. drag 범위를 계산하는 로직에서 계산된 결괏값이 축의 min max값을 넘지 않도록 로직 추가
  • Loading branch information
jhee564 committed Jan 21, 2022
1 parent 5a69de6 commit 7ac6545
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/chart/plugins/plugins.interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const modules = {
const dragEnd = (e) => {
const dragInfo = this.dragInfo;

if (dragInfo?.isMove) {
if (dragInfo?.isMove && dragInfo?.width > 1 && dragInfo?.height > 1) {
const args = {
e,
data: this.findSelectedItems(dragInfo),
Expand Down Expand Up @@ -581,10 +581,10 @@ const modules = {
const yMax = dataRangeY.graphMin + graphHeight * (1 - yMaxRatio);

return {
xMin: +parseFloat(xMin).toFixed(3),
xMax: +parseFloat(xMax).toFixed(3),
yMin: +parseFloat(yMin).toFixed(3),
yMax: +parseFloat(yMax).toFixed(3),
xMin: Math.max(+parseFloat(xMin).toFixed(3), dataRangeX.graphMin),
xMax: Math.min(+parseFloat(xMax).toFixed(3), dataRangeX.graphMax),
yMin: Math.max(+parseFloat(yMin).toFixed(3), dataRangeY.graphMin),
yMax: Math.min(+parseFloat(yMax).toFixed(3), dataRangeY.graphMax),
};
},

Expand Down

0 comments on commit 7ac6545

Please sign in to comment.