StorymapperArrow fixed
This commit is contained in:
39
ArrowPoints.js
Normal file
39
ArrowPoints.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const canvas = document.getElementById("canvas");
|
||||
// Compute arrow polygon
|
||||
import { computeAll } from "athena-utils/Arrow.js";
|
||||
// Polygon merge using Turf library
|
||||
import {mergeTurfPolygons} from "athena-utils/Polygon.js";
|
||||
import {addTurfPolygonToMerge} from "athena-utils/Polygon.js";
|
||||
import {drawPolygon} from "athena-utils/PolygonVisuals.js";
|
||||
|
||||
const points = [
|
||||
{ x: 50, y: 400 },
|
||||
{ x: 150, y: 100 },
|
||||
{ x: 300, y: 200 },
|
||||
{ x: 300, y: 400 },
|
||||
];
|
||||
|
||||
const pointsB = [
|
||||
{ x: 310, y: 300 },
|
||||
{ x: 380, y: 350 },
|
||||
{ x: 400, y: 300 },
|
||||
{ x: 450, y: 330 }
|
||||
];
|
||||
|
||||
const pointsC = [
|
||||
{ x: 50, y: 100 },
|
||||
{ x: 100, y: 100 },
|
||||
{ x: 180, y: 95 }
|
||||
];
|
||||
|
||||
const arrowPolygonA = computeAll(points, 0.02, 50, 10, true, 40, 35);
|
||||
const arrowPolygonB = computeAll(pointsB, 0.02, 10, 10, true, 40, 35);
|
||||
const arrowPolygonC = computeAll(pointsC, 0.02, 50, 10, false, 40, 35);
|
||||
|
||||
const mergedTurfPoly = mergeTurfPolygons(arrowPolygonA, arrowPolygonC);
|
||||
const mergedTurfPolyAll = addTurfPolygonToMerge(mergedTurfPoly, arrowPolygonB);
|
||||
|
||||
console.log(mergedTurfPolyAll);
|
||||
drawPolygon(mergedTurfPolyAll, "rgba(255, 0, 0, 0.5)", canvas);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user