From a2512143cde5e5f79beef2411ae061ece4bb79fe Mon Sep 17 00:00:00 2001 From: stockiNail Date: Fri, 20 May 2022 10:07:45 +0200 Subject: [PATCH 1/3] Reduce complexity for resolving the label callout position --- src/types/label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/label.js b/src/types/label.js index 957c6dee1..75736ab49 100644 --- a/src/types/label.js +++ b/src/types/label.js @@ -221,7 +221,7 @@ function getCalloutSideAdjust(position, options) { function resolveCalloutPosition(element, options) { const position = options.position; - if (position === 'left' || position === 'right' || position === 'top' || position === 'bottom') { + if (positions.indexOf(position) >=0) { return position; } return resolveCalloutAutoPosition(element, options); From d834df41adbc2720869b722771928f248b67bd71 Mon Sep 17 00:00:00 2001 From: stockiNail Date: Fri, 20 May 2022 10:15:11 +0200 Subject: [PATCH 2/3] fixes lint --- src/types/label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/label.js b/src/types/label.js index 75736ab49..5af6eeb5c 100644 --- a/src/types/label.js +++ b/src/types/label.js @@ -221,7 +221,7 @@ function getCalloutSideAdjust(position, options) { function resolveCalloutPosition(element, options) { const position = options.position; - if (positions.indexOf(position) >=0) { + if (positions.indexOf(position) >= 0) { return position; } return resolveCalloutAutoPosition(element, options); From 80a33592cfb214bef6df701a8684ccc08411f483 Mon Sep 17 00:00:00 2001 From: stockiNail Date: Mon, 23 May 2022 12:18:27 +0200 Subject: [PATCH 3/3] uses includes instead of indexOf --- src/types/label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/label.js b/src/types/label.js index 5af6eeb5c..169f43d2e 100644 --- a/src/types/label.js +++ b/src/types/label.js @@ -221,7 +221,7 @@ function getCalloutSideAdjust(position, options) { function resolveCalloutPosition(element, options) { const position = options.position; - if (positions.indexOf(position) >= 0) { + if (positions.includes(position)) { return position; } return resolveCalloutAutoPosition(element, options);