@vertexvis/viewer 1.0.0-testing.6 → 1.0.0-testing.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +15 -5
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js.map +1 -1
- package/dist/collection/components/viewer-markup/viewer-markup-components.js +12 -2
- package/dist/collection/components/viewer-markup/viewer-markup-components.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow.js +1 -1
- package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow.js.map +1 -1
- package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js +1 -1
- package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js.map +1 -1
- package/dist/collection/components/viewer-markup-freeform/viewer-markup-freeform.js +1 -1
- package/dist/collection/components/viewer-markup-freeform/viewer-markup-freeform.js.map +1 -1
- package/dist/components/{p-CjiOj-dT.js → p-5_uPLHD2.js} +2 -2
- package/dist/components/{p-CjiOj-dT.js.map → p-5_uPLHD2.js.map} +1 -1
- package/dist/components/{p-DTWAiCst.js → p-BYYwcm7k.js} +2 -2
- package/dist/components/{p-C2vaYcRL.js → p-CCg_OPx0.js} +2 -2
- package/dist/components/{p-C2vaYcRL.js.map → p-CCg_OPx0.js.map} +1 -1
- package/dist/components/{p-rAFiyecT.js → p-D40K0qiO.js} +2 -2
- package/dist/components/{p-rAFiyecT.js.map → p-D40K0qiO.js.map} +1 -1
- package/dist/components/{p-Dru_6caB.js → p-DXGQW235.js} +2 -2
- package/dist/components/p-DXGQW235.js.map +1 -0
- package/dist/components/vertex-viewer-markup-arrow.js +1 -1
- package/dist/components/vertex-viewer-markup-circle.js +1 -1
- package/dist/components/vertex-viewer-markup-freeform.js +1 -1
- package/dist/components/vertex-viewer-markup-tool.js +1 -1
- package/dist/components/vertex-viewer-markup.js +1 -1
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +15 -5
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js.map +1 -1
- package/dist/types/components/viewer-markup/viewer-markup-components.d.ts +1 -0
- package/dist/types/testing/random.d.ts +1 -0
- package/dist/viewer/p-e50d025a.entry.js +5 -0
- package/dist/viewer/p-e50d025a.entry.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/dist/components/p-Dru_6caB.js.map +0 -1
- package/dist/viewer/p-52cbea01.entry.js +0 -5
- package/dist/viewer/p-52cbea01.entry.js.map +0 -1
- /package/dist/components/{p-DTWAiCst.js.map → p-BYYwcm7k.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["create","x","y","distance","a","b","delta","subtract","Math","sqrt","add","scaleProportional","pt","scale","magnitude","normalizeVector","magnitudeOfPoint","normalDirectionVector","ptA","ptB","orthogonalVector","unitVectorBetweenPoints","abs","vectorXValue","pow","vectorYValue","fromJson","json","obj","JSON","parse","Array","isArray","createArrowheadPoints","start","end","arrowSideLength","arrowHeadTheta","arrowOrthogonalVector","Point.orthogonalVector","normalizedDirection","Point.normalDirectionVector","arrowLeft","Point.subtract","Point.add","Point.scaleProportional","cos","sin","arrowRight","leftPoint","rightPoint","createLineAnchorStylePoints","triangleArrowAngle","lineArrowAngle","Point.distance","arrowHeadHeight","max","min","hashHeight","radius","triangleArrowRelativeHeight","triangleArrowBasePosition","triangleArrowTheta","Angle","toRadians","triangleArrowSideLength","triangleArrow","lineArrowTheta","lineArrowSideLength","lineArrow","hashLineTheta","hashLine","tip","base","arrowTriangle","arrowLine","hash","arrowheadPointsToPolygonPoints","points","scaledRight","scalePointProportional","scaledLeft","scaledBase","map","join","arrowheadPointsToPathPoints","arrowheadPointsToHashPoints","x1","y1","x2","y2","arrowheadPointsToCirclePoints","cx","cy","r","isVertexViewerArrowMarkup","el","HTMLElement","nodeName","parsePoint","value","Point.fromJson","basePoint","scaledPoint","isVertexViewerCircleMarkup","parseBounds","Rectangle","parsePoints","values","Point","stringify","isVertexViewerFreeformMarkup","getBoundingBox2dAnchorPosition","rect","position","width","height","center","translatePointToScreen","canvasDimensions","contentDimensions","centeringBehavior","canvasToContentScaleFactor","effectiveScalar","contentScaleFactor","getScaleFactor","contentRelativePoint","Dimensions","scaledContentWidth","scaledContentHeight","centerOffsetX","centerOffsetY","translateDimensionsToScreen","dimensions","contentRelativeDimensions","translateRectToScreen","fromPointAndDimensions","translatePointToRelative","scaleFactor","point","translatePointsToBounds","original","bounds","createRectangle","initialPoint","currentPoint","maintainAspectRatio","fromPoints","fitBoundsSize","isPortrait","currentIsLeftOfInitial","currentIsAboveInitial","fitBoundsX","fitBoundsY","transformRectangle","current","anchor","left","top","w","h","right","bottom","topLeft","bottomLeft","topRight","bottomRight","isVertexViewerMarkupElement","isValidPointData","every","isNaN","isValidStartEvent","event","target","mode","RelativeAnchor","id","transform","rotation","name","onPointerDown","children","class","style","onTouchStart","preventDefault","SvgShadow","effectiveScale","xOffset","yOffset","filterUnits","in","stdDeviation","dx","dy","result","in2","operator","MarkupInteractionHandler","constructor","this","handlePointerDown","handleInteractionAttempt","handlePointerMove","handleInteractionMove","handlePointerUp","window","removeEventListener","handleInteractionEnd","resizeObserver","ResizeObserver","entry","elementBounds","computeBoundingRect","initialize","element","api","observe","addEventListener","dispose","disconnect","_a","undefined","acceptInteraction"],"sources":["../geometry/src/point.ts","src/components/viewer-markup-arrow/utils.ts","src/components/viewer-markup-circle/utils.ts","src/components/viewer-markup-freeform/utils.ts","src/components/viewer-markup/markup-utils.ts","src/components/viewer-markup/viewer-markup-components.tsx","src/lib/markup/interactions.ts"],"sourcesContent":["import * as Angle from './angle';\nimport { lerp as lerpNumber } from './math';\n\n/**\n * A `Point` represents a cartesian coordinate with a horizontal and vertical\n * position or length.\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * Returns a new `Point` with the given horizontal and vertical position.\n */\nexport function create(x = 0, y = 0): Point {\n return { x, y };\n}\n\n/**\n * Converts a polar coordinate (length and angle) into a Cartesian coordinate.\n */\nexport function polar(length: number, radians: Angle.Angle): Point {\n const x = Math.cos(radians) * length;\n const y = Math.sin(radians) * length;\n return create(x, y);\n}\n\n/**\n * Returns the distance between two points.\n */\nexport function distance(a: Point, b: Point): number {\n const delta = subtract(a, b);\n return Math.sqrt(delta.x * delta.x + delta.y * delta.y);\n}\n\n/**\n * Returns a new `Point` where `b` is subtracted from `a`.\n */\nexport function subtract(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y };\n}\n\n/**\n * Returns a new `Point` where `b` is added to `a`.\n */\nexport function add(a: Point, b: Point): Point {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\n/**\n * Returns `true` if the `x` and `y` positions of `a` and `b` are equal.\n */\nexport function isEqual(a: Point, b: Point): boolean {\n return a.x === b.x && a.y === b.y;\n}\n\n/**\n * Performs a linear interpolation between `a` and `b` and returns the result.\n * The value of `t` is clamped between `[0, 1]`.\n *\n * @param a The start value.\n * @param b The end value.\n * @param t A value between 0 and 1.\n * @returns A point between `a` and `b`.\n */\nexport function lerp(a: Point, b: Point, t: number): Point {\n return {\n x: lerpNumber(a.x, b.x, t),\n y: lerpNumber(a.y, b.y, t),\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are inverted.\n */\nexport function negate(pt: Point): Point {\n return create(-pt.x, -pt.y);\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factors.\n */\nexport function scale(pt: Point, scaleX: number, scaleY: number): Point {\n return {\n x: pt.x * scaleX,\n y: pt.y * scaleY,\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factor.\n */\nexport function scaleProportional(pt: Point, scale: number): Point {\n return {\n x: pt.x * scale,\n y: pt.y * scale,\n };\n}\n\n/**\n * Returns the magnitude of a point.\n */\nexport function magnitude(pt: Point): number {\n return Math.sqrt(pt.x * pt.x + pt.y * pt.y);\n}\n\n/**\n * Transforms a vector into the corresponding normal (unit) vector.\n */\nexport function normalizeVector(pt: Point): Point {\n const magnitudeOfPoint = magnitude(pt);\n if (magnitudeOfPoint === 0) {\n return create(0, 0);\n } else {\n return scaleProportional(pt, 1 / magnitudeOfPoint);\n }\n}\n\n/**\n * Returns a new normal (unit) vector pointing between the two given points.\n */\nexport function normalDirectionVector(ptA: Point, ptB: Point): Point {\n return normalizeVector(subtract(ptB, ptA));\n}\n\n/**\n * Returns a vector orthogonal to the vector between the two given points.\n */\nexport function orthogonalVector(ptA: Point, ptB: Point): Point {\n const unitVectorBetweenPoints = normalDirectionVector(ptA, ptB);\n\n // Handle vectors that are parallel to the x or y axis\n if (unitVectorBetweenPoints.x === 0 || unitVectorBetweenPoints.y === 0) {\n return create(-1 * unitVectorBetweenPoints.y, unitVectorBetweenPoints.x);\n }\n\n if (\n Math.abs(unitVectorBetweenPoints.x) > Math.abs(unitVectorBetweenPoints.y)\n ) {\n const vectorXValue = 1 - Math.pow(unitVectorBetweenPoints.x, 2);\n const vectorYValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n return normalizeVector(create(vectorXValue, vectorYValue));\n } else {\n const vectorXValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n const vectorYValue = 1 - Math.pow(unitVectorBetweenPoints.y, 2);\n return normalizeVector(create(vectorXValue, vectorYValue));\n }\n}\n\n/**\n * Parses a JSON string representation of a Point and returns an object.\n *\n * @param json A JSON string, either in the form `[x,y]` or `{\"x\": 0, \"y\": 0}`\n * @returns A parsed Point.\n */\nexport function fromJson(json: string): Point {\n const obj = JSON.parse(json);\n if (Array.isArray(obj)) {\n const [x, y] = obj;\n return create(x, y);\n } else {\n const { x, y } = obj;\n return create(x, y);\n }\n}\n","import { Angle } from '@vertexvis/geometry';\n\nimport * as Point from '../../../../geometry/src/point';\n\nexport type LineAnchorStyle =\n | 'arrow-triangle'\n | 'arrow-line'\n | 'dot'\n | 'hash'\n | 'none';\n\nexport interface LineAnchorStylePoints {\n tip: Point.Point;\n base: Point.Point;\n arrowTriangle: ArrowheadPoints;\n arrowLine: ArrowheadPoints;\n hash: ArrowheadPoints;\n radius: number;\n}\n\nexport interface ArrowheadPoints {\n leftPoint: Point.Point;\n rightPoint: Point.Point;\n}\n\nexport interface LinePoints {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface CirclePoints {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport function createArrowheadPoints(\n start: Point.Point,\n end: Point.Point,\n arrowSideLength: number,\n arrowHeadTheta: number\n): ArrowheadPoints {\n const arrowOrthogonalVector = Point.orthogonalVector(start, end);\n const normalizedDirection = Point.normalDirectionVector(start, end);\n\n const arrowLeft = Point.subtract(\n end,\n Point.add(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta)\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta)\n )\n )\n );\n const arrowRight = Point.subtract(\n end,\n Point.subtract(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta)\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta)\n )\n )\n );\n\n return {\n leftPoint: arrowLeft,\n rightPoint: arrowRight,\n };\n}\n\nexport function createLineAnchorStylePoints(\n start: Point.Point,\n end: Point.Point,\n triangleArrowAngle = 65,\n lineArrowAngle = 85\n): LineAnchorStylePoints {\n // Adjust the size of the end style to the distance between the start and end points\n const distance = Point.distance(start, end);\n const arrowHeadHeight = Math.max(4, Math.min(16, distance * 0.25));\n const hashHeight = Math.max(4, Math.min(12, distance * 0.16));\n const radius = Math.min(5, distance * 0.1);\n\n // Triangle arrow position\n const triangleArrowRelativeHeight = arrowHeadHeight / distance;\n const triangleArrowBasePosition = Point.add(\n Point.scaleProportional(end, 1 - triangleArrowRelativeHeight),\n Point.scaleProportional(start, triangleArrowRelativeHeight)\n );\n const triangleArrowTheta = Angle.toRadians(triangleArrowAngle / 2);\n const triangleArrowSideLength =\n arrowHeadHeight / Math.cos(triangleArrowTheta);\n const triangleArrow = createArrowheadPoints(\n start,\n end,\n triangleArrowSideLength,\n triangleArrowTheta\n );\n\n // Line arrow position\n const lineArrowTheta = Angle.toRadians(lineArrowAngle / 2);\n const lineArrowSideLength = arrowHeadHeight / Math.cos(lineArrowTheta);\n const lineArrow = createArrowheadPoints(\n start,\n end,\n lineArrowSideLength,\n lineArrowTheta\n );\n\n // Hash position\n // Setting the arrowHeadAngle to 90 degrees results in a\n // straight hash mark perpendicular to the direction of the line\n const hashLineTheta = Angle.toRadians(90);\n const hashLine = createArrowheadPoints(start, end, hashHeight, hashLineTheta);\n\n return {\n tip: end,\n base: triangleArrowBasePosition,\n arrowTriangle: triangleArrow,\n arrowLine: lineArrow,\n hash: hashLine,\n radius: radius,\n };\n}\n\nexport function arrowheadPointsToPolygonPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowTriangle.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowTriangle.leftPoint,\n scale\n );\n const scaledBase = scalePointProportional(points.tip, points.base, scale);\n\n return [points.tip, scaledRight, scaledBase, scaledLeft]\n .map((pt) => `${pt.x},${pt.y}`)\n .join(' ');\n}\n\nexport function arrowheadPointsToPathPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowLine.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowLine.leftPoint,\n scale\n );\n\n return `M${scaledRight.x} ${scaledRight.y} L${points.tip.x} ${points.tip.y} L${scaledLeft.x} ${scaledLeft.y} L${points.tip.x} ${points.tip.y} Z`;\n}\n\nexport function arrowheadPointsToHashPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): LinePoints {\n const scaledRight = scalePointProportional(\n points.tip,\n points.hash.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.hash.leftPoint,\n scale\n );\n\n return {\n x1: scaledRight.x,\n y1: scaledRight.y,\n x2: scaledLeft.x,\n y2: scaledLeft.y,\n };\n}\n\nexport function arrowheadPointsToCirclePoints(\n points: LineAnchorStylePoints,\n scale = 1\n): CirclePoints {\n return {\n cx: points.tip.x,\n cy: points.tip.y,\n r: points.radius * scale,\n };\n}\n\nexport function isVertexViewerArrowMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupArrowElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-ARROW'\n );\n}\n\nexport function parsePoint(\n value: string | Point.Point | undefined\n): Point.Point | undefined {\n return typeof value === 'string' ? Point.fromJson(value) : value;\n}\n\nexport function scalePointProportional(\n basePoint: Point.Point,\n scaledPoint: Point.Point,\n scale: number\n): Point.Point {\n return Point.add(\n basePoint,\n Point.scaleProportional(Point.subtract(scaledPoint, basePoint), scale)\n );\n}\n","import { Rectangle } from '@vertexvis/geometry';\n\nexport function isVertexViewerCircleMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupCircleElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-CIRCLE'\n );\n}\n\nexport function parseBounds(\n value: string | Rectangle.Rectangle | undefined\n): Rectangle.Rectangle | undefined {\n return typeof value === 'string' ? Rectangle.fromJson(value) : value;\n}\n","import { Point } from '@vertexvis/geometry';\n\nexport function parsePoints(\n value: string | Point.Point[] | undefined\n): Point.Point[] | undefined {\n return typeof value === 'string'\n ? JSON.parse(value).map((values: number[]) =>\n Point.fromJson(JSON.stringify(values))\n )\n : value;\n}\n\nexport function isVertexViewerFreeformMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupFreeformElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-FREEFORM'\n );\n}\n","import { Dimensions, Point, Rectangle } from '@vertexvis/geometry';\n\nimport { MarkupCenteringBehavior } from '../../lib/types';\nimport { isVertexViewerArrowMarkup } from '../viewer-markup-arrow/utils';\nimport { isVertexViewerCircleMarkup } from '../viewer-markup-circle/utils';\nimport { isVertexViewerFreeformMarkup } from '../viewer-markup-freeform/utils';\n\nexport type BoundingBox2dAnchorPosition =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'center';\n\nexport function getBoundingBox2dAnchorPosition(\n rect: Rectangle.Rectangle,\n position: BoundingBox2dAnchorPosition\n): Point.Point {\n switch (position) {\n case 'top-left':\n return Point.create(rect.x, rect.y);\n case 'top':\n return Point.create(rect.x + rect.width / 2, rect.y);\n case 'top-right':\n return Point.create(rect.x + rect.width, rect.y);\n case 'right':\n return Point.create(rect.x + rect.width, rect.y + rect.height / 2);\n case 'bottom-right':\n return Point.create(rect.x + rect.width, rect.y + rect.height);\n case 'bottom':\n return Point.create(rect.x + rect.width / 2, rect.y + rect.height);\n case 'bottom-left':\n return Point.create(rect.x, rect.y + rect.height);\n case 'left':\n return Point.create(rect.x, rect.y + rect.height / 2);\n case 'center':\n return Rectangle.center(rect);\n }\n}\n\nexport function translatePointToScreen(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1\n): Point.Point {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativePoint = Point.add(\n Point.scale(pt, contentScaleFactor, contentScaleFactor),\n Dimensions.center(contentDimensions)\n );\n\n // Include an offset for width and height to account for cases where the\n // content dimensions are smaller than the canvas dimensions.\n const scaledContentWidth = contentDimensions.width * effectiveScalar;\n const scaledContentHeight = contentDimensions.height * effectiveScalar;\n const centerOffsetX =\n centeringBehavior === 'both' || centeringBehavior === 'x-only'\n ? Math.max(0, (canvasDimensions.width - scaledContentWidth) / 2)\n : 0;\n const centerOffsetY =\n centeringBehavior === 'both' || centeringBehavior === 'y-only'\n ? Math.max(0, (canvasDimensions.height - scaledContentHeight) / 2)\n : 0;\n\n return Point.create(\n contentRelativePoint.x * effectiveScalar + centerOffsetX,\n contentRelativePoint.y * effectiveScalar + centerOffsetY\n );\n}\n\nexport function translatePointToBounds(\n pt: Point.Point,\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions\n): Point.Point {\n const rectToScreen = translateRectToScreen(rect, canvasDimensions);\n return Point.add(pt, rectToScreen);\n}\n\nexport function translateDimensionsToScreen(\n dimensions: Dimensions.Dimensions,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n scale = 1\n): Dimensions.Dimensions {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativeDimensions = Dimensions.scale(\n contentScaleFactor,\n contentScaleFactor,\n dimensions\n );\n\n return Dimensions.scale(\n effectiveScalar,\n effectiveScalar,\n contentRelativeDimensions\n );\n}\n\n/**\n * Translates a rectangle in relative units, to a rectangle in screen units.\n *\n * Shape coordinates are persisted in relative units, so they can be presented\n * at any size.\n */\nexport function translateRectToScreen(\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions?: Dimensions.Dimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1\n): Rectangle.Rectangle {\n const position = translatePointToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n centeringBehavior,\n scale\n );\n const dimensions = translateDimensionsToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n scale\n );\n return Rectangle.fromPointAndDimensions(position, dimensions);\n}\n\n/**\n * Translates a point in screen units, to a point in relative units.\n */\nexport function translatePointToRelative(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions\n): Point.Point {\n const scaleFactor = 1 / getScaleFactor(canvasDimensions);\n const point = Point.scale(\n Point.subtract(pt, Dimensions.center(canvasDimensions)),\n scaleFactor,\n scaleFactor\n );\n\n return point;\n}\n\n/**\n * Translates a set of points in relative `original` units to\n * points in relative `bounds` units.\n */\nexport function translatePointsToBounds(\n points: Point.Point[],\n original: Rectangle.Rectangle,\n bounds: Rectangle.Rectangle\n): Point.Point[] {\n return points.map((pt) =>\n Point.add(\n Point.scale(\n Point.subtract(pt, original),\n bounds.width / (original.width || 1),\n bounds.height / (original.height || 1)\n ),\n bounds\n )\n );\n}\n\nexport function createRectangle(\n initialPoint: Point.Point,\n currentPoint: Point.Point,\n maintainAspectRatio: boolean\n): Rectangle.Rectangle {\n const bounds = Rectangle.fromPoints(initialPoint, currentPoint);\n if (maintainAspectRatio) {\n const fitBoundsSize = Math.max(bounds.width, bounds.height);\n const isPortrait = bounds.height > bounds.width;\n const currentIsLeftOfInitial = currentPoint.x <= initialPoint.x;\n const currentIsAboveInitial = currentPoint.y <= initialPoint.y;\n const fitBoundsX = currentIsLeftOfInitial\n ? isPortrait\n ? initialPoint.x - fitBoundsSize\n : currentPoint.x\n : initialPoint.x;\n const fitBoundsY = currentIsAboveInitial\n ? isPortrait\n ? currentPoint.y\n : initialPoint.y - fitBoundsSize\n : initialPoint.y;\n return Rectangle.create(\n fitBoundsX,\n fitBoundsY,\n fitBoundsSize,\n fitBoundsSize\n );\n } else {\n return bounds;\n }\n}\n\nexport function transformRectangle(\n bounds: Rectangle.Rectangle,\n start: Point.Point,\n current: Point.Point,\n anchor: BoundingBox2dAnchorPosition,\n maintainAspectRatio?: boolean\n): Rectangle.Rectangle {\n const delta = Point.subtract(current, start);\n const { x: left, y: top, width: w, height: h } = bounds;\n const right = left + w;\n const bottom = top + h;\n const topLeft = Point.create(left, top);\n const bottomLeft = Point.create(left, bottom);\n const topRight = Point.create(right, top);\n const bottomRight = Point.create(right, bottom);\n switch (anchor) {\n case 'top-left':\n return createRectangle(bottomRight, current, !!maintainAspectRatio);\n case 'top':\n return createRectangle(\n bottomRight,\n Point.create(left, current.y),\n !!maintainAspectRatio\n );\n case 'top-right':\n return createRectangle(bottomLeft, current, !!maintainAspectRatio);\n case 'right':\n return createRectangle(\n bottomLeft,\n Point.create(current.x, top),\n !!maintainAspectRatio\n );\n case 'bottom-right':\n return createRectangle(topLeft, current, !!maintainAspectRatio);\n case 'bottom':\n return createRectangle(\n topLeft,\n Point.create(right, current.y),\n !!maintainAspectRatio\n );\n case 'bottom-left':\n return createRectangle(topRight, current, !!maintainAspectRatio);\n case 'left':\n return createRectangle(\n bottomRight,\n Point.create(current.x, top),\n !!maintainAspectRatio\n );\n case 'center':\n return Rectangle.create(\n bounds.x + delta.x,\n bounds.y + delta.y,\n bounds.width,\n bounds.height\n );\n }\n}\n\nexport function isVertexViewerMarkupElement(\n el: HTMLElement\n): el is\n | HTMLVertexViewerMarkupArrowElement\n | HTMLVertexViewerMarkupCircleElement\n | HTMLVertexViewerMarkupFreeformElement {\n return (\n isVertexViewerArrowMarkup(el) ||\n isVertexViewerCircleMarkup(el) ||\n isVertexViewerFreeformMarkup(el)\n );\n}\n\nexport function isValidPointData(...points: Point.Point[]): boolean {\n return points.every((pt) => !isNaN(pt.x) && !isNaN(pt.y));\n}\n\nexport function isValidStartEvent(event: PointerEvent): boolean {\n const el = event.target as HTMLElement;\n\n return isVertexViewerMarkupElement(el) && el.mode !== 'edit';\n}\n\nfunction getScaleFactor(dimensions: Dimensions.Dimensions): number {\n // We intentionally use the content's height when scaling to maintain a consistent coordinate\n // space for markup. This is to ensure the markup will be displayed in the same position\n // on the canvas regardless of the aspect ratio at the time the markup was created.\n // See https://github.com/Vertexvis/vertex-web-sdk/pull/429 for more details.\n return dimensions.height;\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { Point } from '@vertexvis/geometry';\n\nexport interface RelativeAnchorProps {\n id?: string;\n transform?: string;\n rotation?: number;\n name: string;\n point: Point.Point;\n onPointerDown?: (event: PointerEvent) => void;\n}\n\nexport const RelativeAnchor: FunctionalComponent<RelativeAnchorProps> = (\n { id, transform, rotation, name, point, onPointerDown },\n children\n) => {\n return (\n <div\n id={id}\n class=\"bounds-anchor-position\"\n style={{\n top: `${point.y}px`,\n left: `${point.x}px`,\n }}\n onTouchStart={(event) => event.preventDefault()}\n onPointerDown={onPointerDown}\n >\n <div style={{ transform }}>\n <div\n class=\"bounds-anchor\"\n style={{\n transform: `rotateZ(${rotation ?? 0}deg)`,\n }}\n >\n <slot name={name}>{children}</slot>\n </div>\n </div>\n </div>\n );\n};\n\nexport interface SvgShadowProps {\n id: string;\n scale?: number;\n}\n\nexport const SvgShadow: FunctionalComponent<SvgShadowProps> = ({\n id,\n scale,\n}) => {\n // Scale default values for a `<filter>` element by the provided scale.\n // This prevents the filter area from being too small when scale is greater than 1,\n // and uses the default values for a scale less than 1 to prevent the same issue.\n // See https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/filter\n // for more details on the default values used here.\n const effectiveScale = scale ?? 1;\n const xOffset = Math.max(10, 10 * effectiveScale);\n const yOffset = Math.max(10, 10 * effectiveScale);\n const width = Math.max(120, 110 * effectiveScale + xOffset);\n const height = Math.max(120, 110 * effectiveScale + yOffset);\n\n return (\n <filter\n id={id}\n filterUnits=\"userSpaceOnUse\"\n x={`${-xOffset}%`}\n y={`${-yOffset}%`}\n width={`${width}%`}\n height={`${height}%`}\n >\n <feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"2\" />\n <feOffset dx=\"0\" dy=\"1\" result=\"offsetblur\" />\n <feFlood flood-color=\"#000000\" flood-opacity=\"0.25\" />\n <feComposite in2=\"offsetblur\" operator=\"in\" />\n <feMerge>\n <feMergeNode />\n <feMergeNode in=\"SourceGraphic\" />\n </feMerge>\n </filter>\n );\n};\n","import type { InteractionApi, InteractionHandler } from '../interactions';\n\nexport abstract class MarkupInteractionHandler implements InteractionHandler {\n protected element?: HTMLElement;\n protected elementBounds?: DOMRect;\n protected api?: InteractionApi;\n\n private resizeObserver: ResizeObserver;\n\n public constructor() {\n this.resizeObserver = new ResizeObserver(([entry]) => {\n this.elementBounds = this.computeBoundingRect();\n });\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.elementBounds = this.computeBoundingRect();\n this.resizeObserver.observe(this.element);\n\n this.element.addEventListener('pointerdown', this.handlePointerDown);\n }\n\n public dispose(): void {\n this.resizeObserver.disconnect();\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n\n this.element = undefined;\n this.api = undefined;\n }\n\n protected acceptInteraction(): void {\n window.addEventListener('pointermove', this.handlePointerMove);\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private handlePointerDown = (event: PointerEvent): void => {\n this.handleInteractionAttempt(event);\n };\n\n private handlePointerMove = (event: PointerEvent): void => {\n this.handleInteractionMove(event);\n };\n\n private handlePointerUp = (event: PointerEvent): void => {\n window.removeEventListener('pointermove', this.handlePointerMove);\n window.removeEventListener('pointerup', this.handlePointerUp);\n\n this.handleInteractionEnd(event);\n };\n\n protected abstract computeBoundingRect(): DOMRect;\n\n protected abstract handleInteractionAttempt(event: PointerEvent): void;\n\n protected abstract handleInteractionMove(event: PointerEvent): void;\n\n protected abstract handleInteractionEnd(event: PointerEvent): void;\n}\n"],"mappings":";;;6FAeM,SAAUA,EAAOC,EAAI,EAAGC,EAAI,GAChC,MAAO,CAAED,IAAGC,IACd,CAcM,SAAUC,EAASC,EAAUC,GACjC,MAAMC,EAAQC,EAASH,EAAGC,GAC1B,OAAOG,KAAKC,KAAKH,EAAML,EAAIK,EAAML,EAAIK,EAAMJ,EAAII,EAAMJ,EACvD,CAKM,SAAUK,EAASH,EAAUC,GACjC,MAAO,CAAEJ,EAAGG,EAAEH,EAAII,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Aa+B,GAAG,mBAEX,E,MC7ESO,EAOpB,WAAAC,GA6BQC,KAAAC,kBAAqB7B,IAC3B4B,KAAKE,yBAAyB9B,EAAM,EAG9B4B,KAAAG,kBAAqB/B,IAC3B4B,KAAKI,sBAAsBhC,EAAM,EAG3B4B,KAAAK,gBAAmBjC,IACzBkC,OAAOC,oBAAoB,cAAeP,KAAKG,mBAC/CG,OAAOC,oBAAoB,YAAaP,KAAKK,iBAE7CL,KAAKQ,qBAAqBpC,EAAM,EAxChC4B,KAAKS,eAAiB,IAAIC,gBAAe,EAAEC,MACzCX,KAAKY,cAAgBZ,KAAKa,qBAAqB,G,CAI5C,UAAAC,CAAWC,EAAsBC,GACtChB,KAAKe,QAAUA,EACff,KAAKgB,IAAMA,EAEXhB,KAAKY,cAAgBZ,KAAKa,sBAC1Bb,KAAKS,eAAeQ,QAAQjB,KAAKe,SAEjCf,KAAKe,QAAQG,iBAAiB,cAAelB,KAAKC,kB,CAG7C,OAAAkB,G,MACLnB,KAAKS,eAAeW,cACpBC,EAAArB,KAAKe,WAAO,MAAAM,SAAA,SAAAA,EAAEd,oBAAoB,cAAeP,KAAKC,mBAEtDD,KAAKe,QAAUO,UACftB,KAAKgB,IAAMM,S,CAGH,iBAAAC,GACRjB,OAAOY,iBAAiB,cAAelB,KAAKG,mBAC5CG,OAAOY,iBAAiB,YAAalB,KAAKK,gB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{V as o,d as s}from"./p-
|
|
4
|
+
import{V as o,d as s}from"./p-D40K0qiO.js";const t=o;const p=s;export{t as VertexViewerMarkupArrow,p as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-markup-arrow.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{V as o,d as s}from"./p-
|
|
4
|
+
import{V as o,d as s}from"./p-5_uPLHD2.js";const t=o;const p=s;export{t as VertexViewerMarkupCircle,p as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-markup-circle.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{V as o,d as s}from"./p-
|
|
4
|
+
import{V as o,d as s}from"./p-CCg_OPx0.js";const t=o;const p=s;export{t as VertexViewerMarkupFreeform,p as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-markup-freeform.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{t as e,p as t,H as r,d as n,h as i,e as a}from"./p-DmsAWRoU.js";import{s}from"./p-DRh4_Z-g.js";import{F as l,C as o,A as h}from"./p-C0XdJaSj.js";import{b as d,a as c,i as m}from"./p-
|
|
4
|
+
import{t as e,p as t,H as r,d as n,h as i,e as a}from"./p-DmsAWRoU.js";import{s}from"./p-DRh4_Z-g.js";import{F as l,C as o,A as h}from"./p-C0XdJaSj.js";import{b as d,a as c,i as m}from"./p-DXGQW235.js";import{d as u}from"./p-D40K0qiO.js";import{d as f}from"./p-5_uPLHD2.js";import{d as p}from"./p-CCg_OPx0.js";const w=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}:host([elevated=""]){z-index:100}`;const g=t(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.markupBegin=n(this,"markupBegin");this.markupEnd=n(this,"markupEnd");this.tool="arrow";this.disabled=false;this.startLineAnchorStyle="none";this.endLineAnchorStyle="arrow-triangle";this.centeringBehavior="none";this.scale=1;this.stateMap={};this.handleMarkupInteractionBegin=()=>{this.markupBegin.emit()};this.handleMarkupInteractionEnd=()=>{const{markupElement:e}=this.stateMap;if(d(e)){const{points:t,bounds:r}=e;if(t!=null&&t.length>0&&r!=null){this.markupEnd.emit(new l({points:t,bounds:r}))}}else if(c(e)){const{bounds:t}=e;if(t!=null){this.markupEnd.emit(new o({bounds:t}))}}else if(m(e)){const{start:t,end:r}=e;if(t!=null&&r!=null){this.markupEnd.emit(new h({start:t,end:r}))}}}}async handleViewerChanged(){if(this.stateMap.markupElement!=null){this.stateMap.markupElement.viewer=this.viewer}}handleToolChanged(){this.updateMarkupElement()}handleArrowTemplateIdChanged(){this.updateMarkupElement()}handleCircleTemplateIdChanged(){this.updateMarkupElement()}handleFreeformTemplateIdChanged(){this.updateMarkupElement()}handleDisabledChanged(){this.updateMarkupElement()}handleStartLineAnchorStyleChanged(){this.updateMarkupElement()}handleEndLineAnchorStyleChanged(){this.updateMarkupElement()}componentDidLoad(){this.updateMarkupElement()}async reset(){const{markupElement:e}=this.stateMap;if(d(e)){e.points=undefined;e.bounds=undefined;e.mode="create"}else if(c(e)){e.bounds=undefined;e.mode="create"}else if(m(e)){e.start=undefined;e.end=undefined;e.mode="create"}}render(){if(!this.disabled){if(this.tool==="arrow"||this.tool==="circle"||this.tool==="freeform"){return i(a,null,i("slot",null))}else{return i(a,null,`Unsupported tool type '${this.tool}'.`)}}else{return i(a,null)}}createArrowMarkupElement(){if(this.arrowTemplateId!=null){const e=s(window.document.body,this.arrowTemplateId,m,(()=>console.warn(`Arrow template with ID ${this.arrowTemplateId} not found. Using default arrow element.`)),(()=>console.warn(`Arrow template does not contain a vertex-viewer-markup-arrow. Using default arrow element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-arrow")}createCircleMarkupElement(){if(this.circleTemplateId!=null){const e=s(window.document.body,this.circleTemplateId,c,(()=>console.warn(`Circle template with ID ${this.circleTemplateId} not found. Using default circle element.`)),(()=>console.warn(`Circle template does not contain a vertex-viewer-markup-circle. Using default circle element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-circle")}createFreeformMarkupElement(){if(this.freeformTemplateId!=null){const e=s(window.document.body,this.freeformTemplateId,d,(()=>console.warn(`Freeform template with ID ${this.freeformTemplateId} not found. Using default freeform element.`)),(()=>console.warn(`Freeform template does not contain a vertex-viewer-markup-freeform. Using default freeform element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-freeform")}createNewMarkupElement(){switch(this.tool){case"arrow":return this.createArrowMarkupElement();case"circle":return this.createCircleMarkupElement();case"freeform":return this.createFreeformMarkupElement()}}updateMarkupElement(){const{markupElement:e}=this.stateMap;if(e!=null){e.remove();e.dispose();e.viewer=undefined;e.removeEventListener("interactionBegin",this.handleMarkupInteractionBegin);e.removeEventListener("interactionEnd",this.handleMarkupInteractionEnd)}if(!this.disabled){const e=this.createNewMarkupElement();if(this.tool==="arrow"){e.startLineAnchorStyle=this.startLineAnchorStyle;e.endLineAnchorStyle=this.endLineAnchorStyle}e.mode="create";e.viewer=this.viewer;e.originatingViewport=this.originatingViewport;e.centeringBehavior=this.centeringBehavior;e.offset=this.offset;e.scale=this.scale;e.addEventListener("interactionBegin",this.handleMarkupInteractionBegin);e.addEventListener("interactionEnd",this.handleMarkupInteractionEnd);this.stateMap.markupElement=e;this.hostEl.append(e)}}get hostEl(){return this}static get watchers(){return{viewer:[{handleViewerChanged:0}],tool:[{handleToolChanged:0}],arrowTemplateId:[{handleArrowTemplateIdChanged:0}],circleTemplateId:[{handleCircleTemplateIdChanged:0}],freeformTemplateId:[{handleFreeformTemplateIdChanged:0}],disabled:[{handleDisabledChanged:0}],startLineAnchorStyle:[{handleStartLineAnchorStyleChanged:0}],endLineAnchorStyle:[{handleEndLineAnchorStyleChanged:0}]}}static get style(){return w()}},[257,"vertex-viewer-markup-tool",{arrowTemplateId:[1,"arrow-template-id"],circleTemplateId:[1,"circle-template-id"],freeformTemplateId:[1,"freeform-template-id"],tool:[1],disabled:[4],viewer:[16],startLineAnchorStyle:[1025,"start-line-anchor-style"],endLineAnchorStyle:[1025,"end-line-anchor-style"],originatingViewport:[16],centeringBehavior:[1,"centering-behavior"],offset:[16],scale:[2],stateMap:[32],reset:[64]},undefined,{viewer:[{handleViewerChanged:0}],tool:[{handleToolChanged:0}],arrowTemplateId:[{handleArrowTemplateIdChanged:0}],circleTemplateId:[{handleCircleTemplateIdChanged:0}],freeformTemplateId:[{handleFreeformTemplateIdChanged:0}],disabled:[{handleDisabledChanged:0}],startLineAnchorStyle:[{handleStartLineAnchorStyleChanged:0}],endLineAnchorStyle:[{handleEndLineAnchorStyleChanged:0}]}]);function v(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-markup-tool","vertex-viewer-markup-arrow","vertex-viewer-markup-circle","vertex-viewer-markup-freeform"];t.forEach((t=>{switch(t){case"vertex-viewer-markup-tool":if(!customElements.get(e(t))){customElements.define(e(t),g)}break;case"vertex-viewer-markup-arrow":if(!customElements.get(e(t))){u()}break;case"vertex-viewer-markup-circle":if(!customElements.get(e(t))){f()}break;case"vertex-viewer-markup-freeform":if(!customElements.get(e(t))){p()}break}}))}v();const C=g;const k=v;export{C as VertexViewerMarkupTool,k as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-markup-tool.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{t as e,p as t,H as n,d as i,h as r,e as a}from"./p-DmsAWRoU.js";import{p as s}from"./p-Tvs4yxd5.js";import{s as o}from"./p-DRh4_Z-g.js";import{A as d,C as h,F as l}from"./p-C0XdJaSj.js";import{i as c,a as p,b as u}from"./p-
|
|
4
|
+
import{t as e,p as t,H as n,d as i,h as r,e as a}from"./p-DmsAWRoU.js";import{p as s}from"./p-Tvs4yxd5.js";import{s as o}from"./p-DRh4_Z-g.js";import{A as d,C as h,F as l}from"./p-C0XdJaSj.js";import{i as c,a as p,b as u}from"./p-DXGQW235.js";import{d as m}from"./p-D40K0qiO.js";import{d as f}from"./p-5_uPLHD2.js";import{d as w}from"./p-CCg_OPx0.js";const g=()=>`:host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const k=t(class e extends n{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.markupAdded=i(this,"markupAdded");this.markupChanged=i(this,"markupChanged");this.markupRemoved=i(this,"markupRemoved");this.markupSelectionChanged=i(this,"markupSelectionChanged");this.tool="arrow";this.disabled=false;this.selectNew=false;this.startLineAnchorStyle="none";this.endLineAnchorStyle="arrow-triangle";this.centeringBehavior="none";this.scale=1;this.handlePointerMove=e=>{if(this.pointerDownPosition!=null&&s.distance(this.pointerDownPosition,s.create(e.clientX,e.clientY))>2){this.toSelectMarkupId=undefined}};this.handlePointerUp=async e=>{if(!this.disabled){const t=e.target;const n=await this.getMarkupElements();const i=n.find((e=>e===t));if((i===null||i===void 0?void 0:i.id)!=null&&i.id!==""&&i.id===this.toSelectMarkupId){this.selectedMarkupId=t.id}else if(this.pointerDownPosition!=null&&s.distance(this.pointerDownPosition,s.create(e.clientX,e.clientY))<=2){this.selectedMarkupId=undefined}this.toSelectMarkupId=undefined;this.pointerDownPosition=undefined}window.removeEventListener("pointerup",this.handlePointerUp);window.removeEventListener("pointermove",this.handlePointerMove)}}disconnectedCallback(){window.removeEventListener("pointerup",this.handlePointerUp);window.removeEventListener("pointermove",this.handlePointerMove)}async addMarkup(e){if(e instanceof d){const{start:t,end:n,id:i}=e;const r=this.createArrowMarkupElement();r.id=i;r.start=t;r.end=n;r.startLineAnchorStyle=this.startLineAnchorStyle;r.endLineAnchorStyle=this.endLineAnchorStyle;return this.appendMarkupElement(r)}else if(e instanceof h){const{bounds:t,id:n}=e;const i=this.createCircleMarkupElement();i.id=n;i.bounds=t;return this.appendMarkupElement(i)}else if(e instanceof l){const{bounds:t,points:n,id:i}=e;const r=this.createFreeformMarkupElement();r.id=i;r.points=n;r.bounds=t;return this.appendMarkupElement(r)}else{throw new Error(`Cannot add markup. Unknown type '${e}'.`)}}async removeMarkup(e){const t=await this.getMarkupElement(e);if(t!=null){t.remove();this.markupRemoved.emit(t)}return t}async getMarkupElements(){return Array.from(this.hostEl.children).filter((e=>c(e)||p(e)||u(e)))}async getMarkupElement(e){const t=await this.getMarkupElements();return t.find((t=>t.id===e))}async handleSelectedMarkupIdChanged(){const e=await this.getMarkupElements();e.forEach((e=>{if(e.id===this.selectedMarkupId){e.mode="edit";this.markupSelectionChanged.emit(e)}else{e.mode=""}}));if(this.selectedMarkupId==null){this.markupSelectionChanged.emit(undefined)}}handleToolChanged(){this.updatePropsOnMarkupTool()}handleArrowTemplateIdChanged(){this.updatePropsOnMarkupTool()}handleCircleTemplateIdChanged(){this.updatePropsOnMarkupTool()}handleFreeformTemplateIdChanged(){this.updatePropsOnMarkupTool()}async handleViewerChanged(e){this.updatePropsOnMarkupTool();this.updatePropsOnMarkups()}handleDisabledChanged(){this.updatePropsOnMarkupTool()}async handleStartLineAnchorStyleChanged(){this.updatePropsOnMarkupTool();const e=await this.getSelectedArrowMarkup();if(e!=null){e.startLineAnchorStyle=this.startLineAnchorStyle;this.markupChanged.emit(e)}}async handleEndLineAnchorStyleChanged(){this.updatePropsOnMarkupTool();const e=await this.getSelectedArrowMarkup();if(e!=null){e.endLineAnchorStyle=this.endLineAnchorStyle;this.markupChanged.emit(e)}}async handleMarkupEnd(e){var t;const n=e;const i=await this.addMarkup(n.detail);await new Promise((e=>{const t=()=>{i.removeEventListener("viewRendered",t);e()};i.addEventListener("viewRendered",t)}));if(this.selectNew){this.selectedMarkupId=n.detail.id}(t=this.getMarkupTool())===null||t===void 0?void 0:t.reset()}async handleMarkupUpdated(e){const t=e;if(!t.detail.newlyCreatedMarkup){this.markupChanged.emit(t.detail.markup)}}async handleMarkupPointerDown(e){if(!this.disabled){const t=e.target;const n=await this.getMarkupElements();const i=n.find((e=>e===t));if((i===null||i===void 0?void 0:i.id)!=null&&(i===null||i===void 0?void 0:i.id)!==""){this.toSelectMarkupId=t.id}this.pointerDownPosition=s.create(e.clientX,e.clientY);window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}}componentDidLoad(){this.updatePropsOnMarkupTool()}render(){return r(a,{key:"e19690f0d572ece07fc88ad7aab4547cccbf98ba"},r("slot",{key:"8872cfb52c9a9ab9731d88820c41eeae691a5fc5"}))}appendMarkupElement(e){this.updatePropsOnMarkup(e);this.hostEl.appendChild(e);this.markupAdded.emit(e);return e}createArrowMarkupElement(){if(this.arrowTemplateId!=null){const e=o(window.document.body,this.arrowTemplateId,c,(()=>console.warn(`Arrow template with ID ${this.arrowTemplateId} not found. Using default arrow element.`)),(()=>console.warn(`Arrow template does not contain a vertex-viewer-markup-arrow. Using default arrow element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-arrow")}createCircleMarkupElement(){if(this.circleTemplateId!=null){const e=o(window.document.body,this.circleTemplateId,p,(()=>console.warn(`Circle template with ID ${this.circleTemplateId} not found. Using default circle element.`)),(()=>console.warn(`Circle template does not contain a vertex-viewer-markup-circle. Using default circle element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-circle")}createFreeformMarkupElement(){if(this.freeformTemplateId!=null){const e=o(window.document.body,this.freeformTemplateId,u,(()=>console.warn(`Freeform template with ID ${this.freeformTemplateId} not found. Using default freeform element.`)),(()=>console.warn(`Freeform template does not contain a vertex-viewer-markup-freeform. Using default freeform element.`)));if(e!=null){return e}}return document.createElement("vertex-viewer-markup-freeform")}async updatePropsOnMarkups(){const e=await this.getMarkupElements();e.forEach((e=>this.updatePropsOnMarkup(e)))}updatePropsOnMarkup(e){e.viewer=this.viewer;e.originatingViewport=this.originatingViewport;e.centeringBehavior=this.centeringBehavior;e.offset=this.offset;e.scale=this.scale;e.classList.add("viewer-markup__markup")}updatePropsOnMarkupTool(){const e=this.getMarkupTool();if(e!=null){e.disabled=this.disabled;e.arrowTemplateId=this.arrowTemplateId;e.circleTemplateId=this.circleTemplateId;e.freeformTemplateId=this.freeformTemplateId;e.tool=this.tool;e.viewer=this.viewer;e.startLineAnchorStyle=this.startLineAnchorStyle;e.endLineAnchorStyle=this.endLineAnchorStyle;e.originatingViewport=this.originatingViewport;e.centeringBehavior=this.centeringBehavior;e.offset=this.offset;e.scale=this.scale}}getMarkupTool(){return this.hostEl.querySelector("vertex-viewer-markup-tool")}async getSelectedArrowMarkup(){if(this.selectedMarkupId!=null){const e=await this.getMarkupElement(this.selectedMarkupId);return c(e)?e:undefined}}get hostEl(){return this}static get watchers(){return{selectedMarkupId:[{handleSelectedMarkupIdChanged:0}],tool:[{handleToolChanged:0}],arrowTemplateId:[{handleArrowTemplateIdChanged:0}],circleTemplateId:[{handleCircleTemplateIdChanged:0}],freeformTemplateId:[{handleFreeformTemplateIdChanged:0}],viewer:[{handleViewerChanged:0}],originatingViewport:[{handleViewerChanged:0}],centeringBehavior:[{handleViewerChanged:0}],offset:[{handleViewerChanged:0}],scale:[{handleViewerChanged:0}],disabled:[{handleDisabledChanged:0}],startLineAnchorStyle:[{handleStartLineAnchorStyleChanged:0}],endLineAnchorStyle:[{handleEndLineAnchorStyleChanged:0}]}}static get style(){return g()}},[257,"vertex-viewer-markup",{arrowTemplateId:[1,"arrow-template-id"],circleTemplateId:[1,"circle-template-id"],freeformTemplateId:[1,"freeform-template-id"],tool:[1],disabled:[4],viewer:[16],selectedMarkupId:[1025,"selected-markup-id"],selectNew:[4,"select-new"],startLineAnchorStyle:[1025,"start-line-anchor-style"],endLineAnchorStyle:[1025,"end-line-anchor-style"],originatingViewport:[16],centeringBehavior:[1,"centering-behavior"],offset:[16],scale:[2],toSelectMarkupId:[32],pointerDownPosition:[32],addMarkup:[64],removeMarkup:[64],getMarkupElements:[64],getMarkupElement:[64]},[[0,"markupEnd","handleMarkupEnd"],[0,"interactionEnd","handleMarkupUpdated"],[1,"pointerdown","handleMarkupPointerDown"]],{selectedMarkupId:[{handleSelectedMarkupIdChanged:0}],tool:[{handleToolChanged:0}],arrowTemplateId:[{handleArrowTemplateIdChanged:0}],circleTemplateId:[{handleCircleTemplateIdChanged:0}],freeformTemplateId:[{handleFreeformTemplateIdChanged:0}],viewer:[{handleViewerChanged:0}],originatingViewport:[{handleViewerChanged:0}],centeringBehavior:[{handleViewerChanged:0}],offset:[{handleViewerChanged:0}],scale:[{handleViewerChanged:0}],disabled:[{handleDisabledChanged:0}],startLineAnchorStyle:[{handleStartLineAnchorStyleChanged:0}],endLineAnchorStyle:[{handleEndLineAnchorStyleChanged:0}]}]);function v(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-markup","vertex-viewer-markup-arrow","vertex-viewer-markup-circle","vertex-viewer-markup-freeform"];t.forEach((t=>{switch(t){case"vertex-viewer-markup":if(!customElements.get(e(t))){customElements.define(e(t),k)}break;case"vertex-viewer-markup-arrow":if(!customElements.get(e(t))){m()}break;case"vertex-viewer-markup-circle":if(!customElements.get(e(t))){f()}break;case"vertex-viewer-markup-freeform":if(!customElements.get(e(t))){w()}break}}))}v();const C=k;const y=v;export{C as VertexViewerMarkup,y as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-markup.js.map
|
|
@@ -164,8 +164,18 @@ const RelativeAnchor = ({ id, transform, rotation, name, point, onPointerDown },
|
|
|
164
164
|
transform: `rotateZ(${rotation !== null && rotation !== void 0 ? rotation : 0}deg)`,
|
|
165
165
|
} }, h("slot", { name: name }, children)))));
|
|
166
166
|
};
|
|
167
|
-
const SvgShadow = ({ id }) => {
|
|
168
|
-
|
|
167
|
+
const SvgShadow = ({ id, scale, }) => {
|
|
168
|
+
// Scale default values for a `<filter>` element by the provided scale.
|
|
169
|
+
// This prevents the filter area from being too small when scale is greater than 1,
|
|
170
|
+
// and uses the default values for a scale less than 1 to prevent the same issue.
|
|
171
|
+
// See https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/filter
|
|
172
|
+
// for more details on the default values used here.
|
|
173
|
+
const effectiveScale = scale !== null && scale !== void 0 ? scale : 1;
|
|
174
|
+
const xOffset = Math.max(10, 10 * effectiveScale);
|
|
175
|
+
const yOffset = Math.max(10, 10 * effectiveScale);
|
|
176
|
+
const width = Math.max(120, 110 * effectiveScale + xOffset);
|
|
177
|
+
const height = Math.max(120, 110 * effectiveScale + yOffset);
|
|
178
|
+
return (h("filter", { id: id, filterUnits: "userSpaceOnUse", x: `${-xOffset}%`, y: `${-yOffset}%`, width: `${width}%`, height: `${height}%` }, h("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "2" }), h("feOffset", { dx: "0", dy: "1", result: "offsetblur" }), h("feFlood", { "flood-color": "#000000", "flood-opacity": "0.25" }), h("feComposite", { in2: "offsetblur", operator: "in" }), h("feMerge", null, h("feMergeNode", null), h("feMergeNode", { in: "SourceGraphic" }))));
|
|
169
179
|
};
|
|
170
180
|
|
|
171
181
|
class MarkupInteractionHandler {
|
|
@@ -436,7 +446,7 @@ const ViewerMarkupArrow = class {
|
|
|
436
446
|
if (isValidPointData(screenStart, screenEnd)) {
|
|
437
447
|
const arrowheadStartPoints = createLineAnchorStylePoints(screenEnd, screenStart);
|
|
438
448
|
const arrowheadEndPoints = createLineAnchorStylePoints(screenStart, screenEnd);
|
|
439
|
-
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "arrow-shadow" })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#arrow-shadow)" }, this.renderLineAnchorStyle(this.startLineAnchorStyle, arrowheadStartPoints), h("line", { id: "arrow-line", class: "line", x1: arrowheadEndPoints.tip.x, y1: arrowheadEndPoints.tip.y, x2: arrowheadStartPoints.tip.x, y2: arrowheadStartPoints.tip.y }), this.renderLineAnchorStyle(this.endLineAnchorStyle, arrowheadEndPoints)), this.mode === 'edit' && (h("g", { transform: `translate(${offsetX} ${offsetY})` }, h("line", { id: "bounding-box-1d-line", class: "bounds-line", x1: screenStart.x, y1: screenStart.y, x2: screenEnd.x, y2: screenEnd.y })))), this.mode === 'edit' && (h(BoundingBox1d, { start: screenStart, end: screenEnd, offset: { x: offsetX, y: offsetY }, onStartAnchorPointerDown: (event) => this.interactionHandler.editAnchor('start', event), onCenterAnchorPointerDown: (event) => this.interactionHandler.editAnchor('center', event), onEndAnchorPointerDown: (event) => this.interactionHandler.editAnchor('end', event) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
449
|
+
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "arrow-shadow", scale: this.scale })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#arrow-shadow)" }, this.renderLineAnchorStyle(this.startLineAnchorStyle, arrowheadStartPoints), h("line", { id: "arrow-line", class: "line", x1: arrowheadEndPoints.tip.x, y1: arrowheadEndPoints.tip.y, x2: arrowheadStartPoints.tip.x, y2: arrowheadStartPoints.tip.y }), this.renderLineAnchorStyle(this.endLineAnchorStyle, arrowheadEndPoints)), this.mode === 'edit' && (h("g", { transform: `translate(${offsetX} ${offsetY})` }, h("line", { id: "bounding-box-1d-line", class: "bounds-line", x1: screenStart.x, y1: screenStart.y, x2: screenEnd.x, y2: screenEnd.y })))), this.mode === 'edit' && (h(BoundingBox1d, { start: screenStart, end: screenEnd, offset: { x: offsetX, y: offsetY }, onStartAnchorPointerDown: (event) => this.interactionHandler.editAnchor('start', event), onCenterAnchorPointerDown: (event) => this.interactionHandler.editAnchor('center', event), onEndAnchorPointerDown: (event) => this.interactionHandler.editAnchor('end', event) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
440
450
|
}
|
|
441
451
|
else {
|
|
442
452
|
return h(Host, null);
|
|
@@ -660,7 +670,7 @@ const ViewerMarkupCircle = class {
|
|
|
660
670
|
const center = rectangle.center(relativeBounds);
|
|
661
671
|
const offsetX = ((_b = (_a = this.offset) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0) / getWindowDevicePixelRatio();
|
|
662
672
|
const offsetY = ((_d = (_c = this.offset) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0) / getWindowDevicePixelRatio();
|
|
663
|
-
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "circle-shadow" })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#circle-shadow)" }, h("ellipse", { class: "ellipse", cx: center.x, cy: center.y, rx: relativeBounds.width / 2, ry: relativeBounds.height / 2, stroke: '#000ff0', "stroke-width": 4, fill: 'none' }))), this.mode === 'edit' && (h(BoundingBox2d, { bounds: relativeBounds, offset: { x: offsetX, y: offsetY }, onTopLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-left', e), onTopRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-right', e), onTopAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top', e), onBottomLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-left', e), onBottomRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-right', e), onBottomAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom', e), onLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('left', e), onRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('right', e), onCenterAnchorPointerDown: (e) => this.interactionHandler.editAnchor('center', e) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
673
|
+
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "circle-shadow", scale: this.scale })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#circle-shadow)" }, h("ellipse", { class: "ellipse", cx: center.x, cy: center.y, rx: relativeBounds.width / 2, ry: relativeBounds.height / 2, stroke: '#000ff0', "stroke-width": 4, fill: 'none' }))), this.mode === 'edit' && (h(BoundingBox2d, { bounds: relativeBounds, offset: { x: offsetX, y: offsetY }, onTopLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-left', e), onTopRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-right', e), onTopAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top', e), onBottomLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-left', e), onBottomRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-right', e), onBottomAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom', e), onLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('left', e), onRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('right', e), onCenterAnchorPointerDown: (e) => this.interactionHandler.editAnchor('center', e) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
664
674
|
}
|
|
665
675
|
else {
|
|
666
676
|
return (h(Host, null, h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart })));
|
|
@@ -900,7 +910,7 @@ const ViewerMarkupFreeform = class {
|
|
|
900
910
|
if (this.screenPoints.length > 0 && this.elementBounds != null) {
|
|
901
911
|
const offsetX = ((_b = (_a = this.offset) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0) / getWindowDevicePixelRatio();
|
|
902
912
|
const offsetY = ((_d = (_c = this.offset) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0) / getWindowDevicePixelRatio();
|
|
903
|
-
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "freeform-markup-shadow" })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#freeform-markup-shadow)" }, h("path", { class: "path", d: this.screenPoints.reduce((d, pt) => `${d}L${pt.x},${pt.y}`, `M${this.screenPoints[0].x},${this.screenPoints[0].y}`), fill: "none" }))), this.mode === 'edit' && this.bounds != null && (h(BoundingBox2d, { bounds: translateRectToScreen(this.bounds, this.elementBounds, this.originatingViewport, this.centeringBehavior, this.scale), offset: { x: offsetX, y: offsetY }, onTopLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-left', e), onTopRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-right', e), onTopAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top', e), onBottomLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-left', e), onBottomRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-right', e), onBottomAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom', e), onLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('left', e), onRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('right', e), onCenterAnchorPointerDown: (e) => this.interactionHandler.editAnchor('center', e) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
913
|
+
return (h(Host, null, h("svg", { class: "svg", onTouchStart: this.handleTouchStart }, h("defs", null, h(SvgShadow, { id: "freeform-markup-shadow", scale: this.scale })), h("g", { transform: `translate(${offsetX} ${offsetY})`, filter: "url(#freeform-markup-shadow)" }, h("path", { class: "path", d: this.screenPoints.reduce((d, pt) => `${d}L${pt.x},${pt.y}`, `M${this.screenPoints[0].x},${this.screenPoints[0].y}`), fill: "none" }))), this.mode === 'edit' && this.bounds != null && (h(BoundingBox2d, { bounds: translateRectToScreen(this.bounds, this.elementBounds, this.originatingViewport, this.centeringBehavior, this.scale), offset: { x: offsetX, y: offsetY }, onTopLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-left', e), onTopRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top-right', e), onTopAnchorPointerDown: (e) => this.interactionHandler.editAnchor('top', e), onBottomLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-left', e), onBottomRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom-right', e), onBottomAnchorPointerDown: (e) => this.interactionHandler.editAnchor('bottom', e), onLeftAnchorPointerDown: (e) => this.interactionHandler.editAnchor('left', e), onRightAnchorPointerDown: (e) => this.interactionHandler.editAnchor('right', e), onCenterAnchorPointerDown: (e) => this.interactionHandler.editAnchor('center', e) })), this.mode === 'create' && (h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart }))));
|
|
904
914
|
}
|
|
905
915
|
else {
|
|
906
916
|
return (h(Host, null, h("div", { class: "create-overlay", onTouchStart: this.handleTouchStart })));
|