aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/InteractionUtils.tsx
diff options
context:
space:
mode:
authorgeireann <60007097+geireann@users.noreply.github.com>2020-08-24 18:47:33 +0800
committergeireann <60007097+geireann@users.noreply.github.com>2020-08-24 18:47:33 +0800
commit31fac41cb8a3bd19b02dddc116b11c962f3339d3 (patch)
tree7d3b0bcf04318d479158915f5ee7fc8a30ef580c /src/client/util/InteractionUtils.tsx
parent78efe1087488265da4ea37373a2a9a22a7f8cf10 (diff)
parenta9e08e0504e8002bc5d991b6a13777577ddd8f9f (diff)
Merge branch 'master' into presentation_updates
Diffstat (limited to 'src/client/util/InteractionUtils.tsx')
-rw-r--r--src/client/util/InteractionUtils.tsx53
1 files changed, 43 insertions, 10 deletions
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx
index 13c4fac25..bb58423c8 100644
--- a/src/client/util/InteractionUtils.tsx
+++ b/src/client/util/InteractionUtils.tsx
@@ -300,19 +300,52 @@ export namespace InteractionUtils {
return points;
case "circle":
+ // const centerX = (right + left) / 2;
+ // const centerY = (bottom + top) / 2;
+ // const radius = bottom - centerY;
+
+ // for (var y = top; y < bottom; y++) {
+ // const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
+ // points.push({ X: x, Y: y });
+ // }
+ // for (var y = bottom; y > top; y--) {
+ // const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
+ // const newX = centerX - (x - centerX);
+ // points.push({ X: newX, Y: y });
+ // }
+ // points.push({ X: Math.sqrt(Math.pow(radius, 2) - (Math.pow((top - centerY), 2))) + centerX, Y: top });
const centerX = (right + left) / 2;
const centerY = (bottom + top) / 2;
- const radius = bottom - centerY;
- for (var y = top; y < bottom; y++) {
- const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
- points.push({ X: x, Y: y });
- }
- for (var y = bottom; y > top; y--) {
- const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
- const newX = centerX - (x - centerX);
- points.push({ X: newX, Y: y });
+ if ((bottom - centerY) < (right - centerX)) {
+ const radius = bottom - centerY;
+ for (var y = top; y < bottom; y++) {
+ const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
+ points.push({ X: x, Y: y });
+ }
+ for (var y = bottom; y > top; y--) {
+ const x = Math.sqrt(Math.pow(radius, 2) - (Math.pow((y - centerY), 2))) + centerX;
+ const newX = centerX - (x - centerX);
+ points.push({ X: newX, Y: y });
+ }
+ points.push({ X: Math.sqrt(Math.pow(radius, 2) - (Math.pow((top - centerY), 2))) + centerX, Y: top });
+
+ } else {
+ //right = bottom
+ //left = top
+ const radius = right - centerX;
+ for (var x = left; x < right; x++) {
+ const y = Math.sqrt(Math.pow(radius, 2) - (Math.pow((x - centerX), 2))) + centerY;
+ points.push({ X: x, Y: y });
+ }
+ for (var x = right; x > left; x--) {
+ const y = Math.sqrt(Math.pow(radius, 2) - (Math.pow((x - centerX), 2))) + centerY;
+ const newY = centerY - (y - centerY);
+ points.push({ X: x, Y: newY });
+ }
+ points.push({ X: left, Y: Math.sqrt(Math.pow(radius, 2) - (Math.pow((left - centerX), 2))) + centerY });
+
+
}
- points.push({ X: Math.sqrt(Math.pow(radius, 2) - (Math.pow((top - centerY), 2))) + centerX, Y: top });
return points;
// case "arrow":
// const x1 = left;