forked from susielu/d3-annotation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
d3-annotation.independent.js.map
1 lines (1 loc) · 103 KB
/
d3-annotation.independent.js.map
1
{"version":3,"file":"d3-annotation.independent.js","sources":["src/Annotation.js","src/AnnotationCollection.js","src/Handles.js","src/Note/alignment.js","src/Builder.js","src/Note/lineType-vertical.js","src/Note/lineType-horizontal.js","src/Connector/type-line.js","src/Connector/type-elbow.js","src/Connector/type-curve.js","src/Connector/end-arrow.js","src/Connector/end-dot.js","src/Subject/circle.js","src/Subject/rect.js","src/Subject/threshold.js","src/Subject/badge.js","src/Types-d3.js","src/Adapter-d3.js","index.js"],"sourcesContent":["export default class Annotation {\n constructor({\n x = 0,\n y = 0,\n nx,\n ny,\n dy = 0,\n dx = 0,\n color = \"grey\",\n data,\n type,\n subject,\n connector,\n note,\n disable,\n id,\n className\n }) {\n this._dx = nx !== undefined ? nx - x : dx\n this._dy = ny !== undefined ? ny - y : dy\n this._x = x\n this._y = y\n this._color = color\n this.id = id\n this._className = className || \"\"\n\n this._type = type || \"\"\n this.data = data\n\n this.note = note || {}\n this.connector = connector || {}\n this.subject = subject || {}\n\n this.disable = disable || []\n }\n\n updatePosition() {\n if (this.type.setPosition) {\n this.type.setPosition()\n if (\n this.type.subject &&\n this.type.subject.selectAll(\":not(.handle)\").nodes().length !== 0\n ) {\n this.type.redrawSubject()\n }\n }\n }\n\n clearComponents() {\n this.type.clearComponents && this.type.clearComponents()\n }\n\n get className() {\n return this._className\n }\n\n set className(className) {\n this._className = className\n if (this.type.setClassName) this.type.setClassName()\n }\n\n updateOffset() {\n if (this.type.setOffset) {\n this.type.setOffset()\n\n if (this.type.connector.selectAll(\":not(.handle)\").nodes().length !== 0) {\n this.type.redrawConnector()\n }\n\n this.type.redrawNote()\n }\n }\n\n get type() {\n return this._type\n }\n\n set type(type) {\n this._type = type\n this.clearComponents()\n }\n\n get x() {\n return this._x\n }\n set x(x) {\n this._x = x\n this.updatePosition()\n }\n\n get y() {\n return this._y\n }\n set y(y) {\n this._y = y\n this.updatePosition()\n }\n\n get color() {\n return this._color\n }\n set color(color) {\n this._color = color\n this.updatePosition()\n }\n\n get dx() {\n return this._dx\n }\n set dx(dx) {\n this._dx = dx\n this.updateOffset()\n }\n\n get dy() {\n return this._dy\n }\n set dy(dy) {\n this._dy = dy\n this.updateOffset()\n }\n\n set nx(nx) {\n this._dx = nx - this._x\n this.updateOffset()\n }\n\n set ny(ny) {\n this._dy = ny - this._y\n this.updateOffset()\n }\n\n get offset() {\n return { x: this._dx, y: this._dy }\n }\n\n set offset({ x, y }) {\n this._dx = x\n this._dy = y\n this.updateOffset()\n }\n\n get position() {\n return { x: this._x, y: this._y }\n }\n\n set position({ x, y }) {\n this._x = x\n this._y = y\n this.updatePosition()\n }\n\n get translation() {\n return {\n x: this._x + this._dx,\n y: this._y + this._dy\n }\n }\n\n get json() {\n const json = {\n x: this._x,\n y: this._y,\n dx: this._dx,\n dy: this._dy\n }\n\n if (this.data && Object.keys(this.data).length > 0) json.data = this.data\n if (this.type) json.type = this.type\n if (this._className) json.className = this._className\n\n if (Object.keys(this.connector).length > 0) json.connector = this.connector\n if (Object.keys(this.subject).length > 0) json.subject = this.subject\n if (Object.keys(this.note).length > 0) json.note = this.note\n\n return json\n }\n}\n","export default class AnnotationCollection {\n\n constructor ({ annotations, accessors, accessorsInverse }) {\n this.accessors = accessors\n this.accessorsInverse = accessorsInverse\n this.annotations = annotations\n }\n\n clearTypes (newSettings) {\n this.annotations.forEach(d => {\n d.type = undefined\n d.subject = newSettings && newSettings.subject || d.subject\n d.connector = newSettings && newSettings.connector || d.connector\n d.note = newSettings && newSettings.note || d.note\n })\n }\n\n setPositionWithAccessors () {\n this.annotations.forEach(d => {\n d.type.setPositionWithAccessors(this.accessors)\n })\n }\n\n editMode (editMode) { this.annotations.forEach(a => {\n if (a.type) {\n a.type.editMode = editMode\n a.type.updateEditMode()\n }\n })\n }\n\n updateDisable (disable) {\n this.annotations.forEach(a => {\n a.disable = disable\n if (a.type) {\n disable.forEach(d => {\n if (a.type[d]) {\n a.type[d].remove && a.type[d].remove()\n a.type[d] = undefined\n }\n })\n }\n })\n }\n\n updateTextWrap (textWrap) {\n this.annotations.forEach(a => {\n if (a.type && a.type.updateTextWrap) {\n a.type.updateTextWrap(textWrap)\n }\n })\n }\n\n updateText () {\n this.annotations.forEach(a => {\n if (a.type && a.type.drawText) {\n a.type.drawText()\n }\n })\n }\n\n updateNotePadding (notePadding) {\n this.annotations.forEach(a => {\n if (a.type) {\n a.type.notePadding = notePadding\n }\n })\n }\n\n get json () { \n return this.annotations.map(a => { \n const json = a.json\n if (this.accessorsInverse && a.data) {\n json.data = {}\n Object.keys(this.accessorsInverse).forEach(k => {\n json.data[k] = this.accessorsInverse[k]({ x: a.x, y: a.y})\n\n //TODO make this feasible to map back to data for other types of subjects\n })\n }\n return json\n })\n }\n\n get noteNodes () {\n return this.annotations.map(a => ({ ...a.type.getNoteBBoxOffset(), positionX: a.x, positionY: a.y }))\n }\n\n //TODO: come back and rethink if a.x and a.y are applicable in all situations\n // get connectorNodes() {\n // return this.annotations.map(a => ({ ...a.type.getConnectorBBox(), startX: a.x, startY: a.y}))\n // }\n\n // get subjectNodes() {\n // return this.annotations.map(a => ({ ...a.type.getSubjectBBox(), startX: a.x, startY: a.y}))\n // }\n\n // get annotationNodes() {\n // return this.annotations.map(a => ({ ...a.type.getAnnotationBBox(), startX: a.x, startY: a.y}))\n // }\n}\n","import { select } from \"d3-selection\"\nimport { drag } from \"d3-drag\"\n\nexport const pointHandle = ({ cx = 0, cy = 0 }) => {\n return { move: { x: cx, y: cy } }\n}\n\nexport const circleHandles = ({ cx = 0, cy = 0, r1, r2, padding }) => {\n const h = { move: { x: cx, y: cy } }\n\n if (r1 !== undefined) {\n h.r1 = { x: cx + r1 / Math.sqrt(2), y: cy + r1 / Math.sqrt(2) }\n }\n\n if (r2 !== undefined) {\n h.r2 = { x: cx + r2 / Math.sqrt(2), y: cy + r2 / Math.sqrt(2) }\n }\n\n if (padding !== undefined) {\n h.padding = { x: cx + r1 + padding, y: cy }\n }\n\n return h\n}\n\nexport const rectHandles = ({\n x1 = 0,\n y1 = 0,\n x2 = x1,\n y2 = y1,\n width,\n height\n}) => {\n const w = width || Math.abs(x2 - x1)\n const h = height || Math.abs(y2 - y1)\n\n return {\n move: {\n x: Math.min(x1, x2) + w / 2,\n y: Math.min(y1, y2) - 10\n },\n width: {\n x: Math.max(x1, x2),\n y: Math.min(y1, y2) + h / 2\n },\n height: {\n x: Math.min(x1, x2) + w / 2,\n y: Math.max(y1, y2)\n }\n }\n}\n\nexport const lineHandles = ({ x1, y1, x2, y2, x, y }) => {\n const minY = Math.min(y1, y2)\n const minX = Math.min(x1, x2)\n\n const height = Math.abs(y2 - y1)\n const width = Math.abs(x2 - x1)\n\n return {\n move: {\n x: x || minX + width / 2,\n y: y || minY + height / 2\n }\n }\n}\n\n//arc handles\nexport const addHandles = ({ group, handles, r = 10 }) => {\n //give it a group and x,y to draw handles\n //then give it instructions on what the handles change\n const h = group.selectAll(\"circle.handle\").data(handles)\n\n h\n .enter()\n .append(\"circle\")\n .attr(\"class\", \"handle\")\n .attr(\"fill\", \"grey\")\n .attr(\"fill-opacity\", 0.1)\n .attr(\"cursor\", \"move\")\n .attr(\"stroke-dasharray\", 5)\n .attr(\"stroke\", \"grey\")\n .call(\n drag()\n .container(select(\"g.annotations\").node())\n .on(\"start\", d => d.start && d.start(d))\n .on(\"drag\", d => d.drag && d.drag(d))\n .on(\"end\", d => d.end && d.end(d))\n )\n\n group\n .selectAll(\"circle.handle\")\n .attr(\"cx\", d => d.x)\n .attr(\"cy\", d => d.y)\n .attr(\"r\", d => d.r || r)\n .attr(\"class\", d => `handle ${d.className || \"\"}`)\n\n h.exit().remove()\n}\n","\nexport const leftRightDynamic = (align, y) => {\n if (align === \"dynamic\" || align === \"left\" || align === \"right\") {\n if (y < 0) { align = \"top\" }\n else { align = \"bottom\" } \n }\n return align\n}\n\nexport const topBottomDynamic = (align, x) => {\n if (align === \"dynamic\" || align === \"top\" || align === \"bottom\") {\n if (x < 0) { align = \"right\" }\n else { align = \"left\" } \n }\n return align\n}\n\nconst orientationTopBottom = [\"topBottom\", \"top\", \"bottom\"]\nconst orientationLeftRight = [\"leftRight\", \"left\", \"right\"]\n\nexport default ({ padding=0, bbox={x:0, y:0, width:0, height:0}, align, orientation, offset={x:0, y:0} }) => {\n let x = -bbox.x \n let y = 0//-bbox.y\n if ( orientationTopBottom.indexOf(orientation) !== -1 ) {\n align = topBottomDynamic(align, offset.x)\n if (offset.y < 0 && orientation === \"topBottom\" || orientation === \"top\") { \n y -= bbox.height + padding\n } else {\n y += padding\n }\n\n if ( align === \"middle\" ) {\n x -= bbox.width/2\n } else if (align === \"right\" ) {\n x -= bbox.width\n } \n\n } else if ( orientationLeftRight.indexOf(orientation) !== -1 ) {\n align = leftRightDynamic(align, offset.y)\n if (offset.x < 0 && orientation === \"leftRight\" || orientation === \"left\") { \n x -= bbox.width + padding\n } else {\n x += padding\n }\n\n if ( align === \"middle\" ) {\n y -= bbox.height/2\n } else if (align === \"top\" ) {\n y -= bbox.height\n }\n } \n\n return { x, y }\n}","import { line, arc, curveLinear } from \"d3-shape\"\n\nexport const lineBuilder = ({ data, curve=curveLinear, canvasContext, className, classID }) => { \n const lineGen = line()\n .curve(curve)\n\n const builder = {\n type: 'path',\n className,\n classID,\n data\n }\n\n if (canvasContext) {\n lineGen.context(canvasContext)\n builder.pathMethods = lineGen\n\n } else {\n builder.attrs = {\n d: lineGen(data)\n }\n }\n\n return builder\n}\n\nexport const arcBuilder = ({ data, canvasContext, className, classID }) => {\n\n const builder = {\n type: 'path',\n className,\n classID,\n data\n }\n\n const arcShape = arc()\n .innerRadius(data.innerRadius || 0)\n .outerRadius(data.outerRadius || data.radius || 2)\n .startAngle(data.startAngle || 0)\n .endAngle(data.endAngle || 2*Math.PI)\n\n if (canvasContext) {\n arcShape.context(canvasContext)\n builder.pathMethods = lineGen\n\n } else {\n \n builder.attrs = {\n d: arcShape()\n }\n }\n\n return builder\n}","import { lineBuilder } from '../Builder'\nimport { leftRightDynamic } from './alignment'\n\nexport default ({ align, x=0, y=0, bbox, offset }) => {\n align = leftRightDynamic(align, offset.y)\n\n if (align === \"top\") { y -= bbox.height } \n else if (align === \"middle\") { y -= bbox.height/2 }\n\n const data = [[x, y], [x, y + bbox.height]]\n return { components: [lineBuilder({ data, className : \"note-line\" })] }\n}","import { lineBuilder } from '../Builder'\nimport { topBottomDynamic } from './alignment'\n\nexport default ({ align, x=0, y=0, offset, bbox }) => {\n align = topBottomDynamic(align, offset.x)\n\n if (align === \"right\") { x -= bbox.width }\n else if (align === \"middle\") { x -= bbox.width/2 }\n\n const data = [[x, y], [x + bbox.width, y]]\n return { components: [lineBuilder({ data, className : \"note-line\" })] }\n}","import { lineBuilder } from '../Builder'\n\nexport const lineSetup = ({ type, subjectType }) => {\n let annotation = type.annotation\n let offset = annotation.position\n \n let x1 = annotation.x - offset.x,\n x2 = x1 + annotation.dx,\n y1 = annotation.y - offset.y,\n y2 = y1 + annotation.dy\n\n\n const subjectData = annotation.subject\n\n if (subjectType === \"circle\" && (subjectData.outerRadius || subjectData.radius)) {\n const h = Math.sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2))\n const angle = Math.asin(-y2/h)\n const r = subjectData.outerRadius || subjectData.radius + (subjectData.radiusPadding || 0)\n\n x1 = Math.abs(Math.cos(angle)*r)*(x2 < 0 ? -1 : 1)\n y1 = Math.abs(Math.sin(angle)*r)*(y2 < 0 ? -1 : 1)\n\n }\n\n if (subjectType === \"rect\") {\n const { width, height } = subjectData\n \n if (width > 0 && annotation.dx > 0 || width < 0 && annotation.dx < 0) {\n if (Math.abs(width) > Math.abs(annotation.dx)) x1 = width/2\n else x1 = width\n } \n if (height > 0 && annotation.dy > 0 || height < 0 && annotation.dy < 0) {\n if (Math.abs(height) > Math.abs(annotation.dy)) y1 = height/2\n else y1 = height\n }\n if (x1 === width/2 && y1 === height/2) { x1 = x2; y1 = y2;}\n }\n\n\n return [[x1, y1], [x2, y2]]\n}\n\nexport default (connectorData) => {\n const data = lineSetup(connectorData)\n return { components: [lineBuilder({ data, className : \"connector\" })]} \n}","import { lineBuilder } from '../Builder'\n\nexport default ({ type, subjectType }) => {\n\n const annotation = type.annotation\n const offset = annotation.position\n\n let x1 = annotation.x - offset.x,\n x2 = x1 + annotation.dx,\n y1 = annotation.y - offset.y,\n y2 = y1 + annotation.dy\n\n const subjectData = annotation.subject\n\n if (subjectType === \"rect\") {\n const { width, height } = subjectData\n \n if (width > 0 && annotation.dx > 0 || width < 0 && annotation.dx < 0) {\n if (Math.abs(width) > Math.abs(annotation.dx)) x1 = width/2\n else x1 = width\n } \n if (height > 0 && annotation.dy > 0 || height < 0 && annotation.dy < 0) {\n if (Math.abs(height) > Math.abs(annotation.dy)) y1 = height/2\n else y1 = height\n }\n if (x1 === width/2 && y1 === height/2) { x1 = x2; y1 = y2;}\n }\n\n let data = [[x1, y1], [x2, y2]]\n\n let diffY = y2 - y1\n let diffX = x2 - x1\n let xe = x2 \n let ye = y2\n let opposite = y2 < y1 && x2 > x1 || x2 < x1 && y2 > y1 ? -1 : 1\n\n if (Math.abs(diffX) < Math.abs(diffY)) {\n xe = x2\n ye = y1 + diffX*opposite\n } else {\n ye = y2\n xe = x1 + diffY*opposite\n }\n \n if (subjectType === \"circle\" && (subjectData.outerRadius || subjectData.radius)) {\n const r = (subjectData.outerRadius || subjectData.radius) + (subjectData.radiusPadding || 0)\n const length = r/Math.sqrt(2)\n\n if (Math.abs(diffX) > length && Math.abs(diffY) > length) {\n x1 = length*(x2 < 0 ? -1 : 1)\n y1 = length*(y2 < 0 ? -1 : 1)\n data = [[x1, y1], [xe , ye ], [x2, y2]]\n\n } else if (Math.abs(diffX) > Math.abs(diffY)) {\n const angle = Math.asin(-y2/r)\n x1 = Math.abs(Math.cos(angle)*r)*(x2 < 0 ? -1 : 1)\n data = [[ x1, y2], [x2, y2]]\n } else {\n const angle = Math.acos(x2/r)\n y1 = Math.abs(Math.sin(angle)*r)*(y2 < 0 ? -1 : 1)\n data = [[ x2, y1], [x2, y2]]\n }\n } else {\n data = [[x1, y1], [xe , ye], [x2, y2]]\n }\n\n return { components: [lineBuilder({ data, className: \"connector\"})]}\n}\n","import { lineBuilder } from '../Builder'\nimport { event } from 'd3-selection'\nimport { lineSetup } from './type-line'\nimport { curveCatmullRom } from 'd3-shape'\nimport { pointHandle } from '../Handles'\n\nexport default ({ type, connectorData, subjectType }) => {\n\n if (!connectorData) { connectorData = {} }\n if (!connectorData.points || typeof connectorData.points === \"number\") { \n connectorData.points = createPoints(type.annotation.offset, connectorData.points) \n }\n if (!connectorData.curve) { connectorData.curve = curveCatmullRom }\n\n let handles = []\n\n if (type.editMode) {\n const cHandles = connectorData.points\n .map((c,i) => ({...pointHandle({cx: c[0], cy: c[1]}), index: i}))\n\n const updatePoint = (index) => { \n connectorData.points[index][0] += event.dx\n connectorData.points[index][1] += event.dy\n type.redrawConnector()\n }\n \n handles = type.mapHandles(cHandles\n .map(h => ({ ...h.move, drag: updatePoint.bind(type, h.index)})))\n\n }\n\n let data = lineSetup({ type, subjectType })\n data = [data[0], ...connectorData.points, data[1]]\n const components = [lineBuilder({ data, curve: connectorData.curve, className: \"connector\" })]\n\n return { components , handles }\n}\n\nconst createPoints = function ( offset, anchors=2) {\n const diff = { x: offset.x/(anchors + 1), y: offset.y/(anchors + 1) }\n const p = []\n\n let i = 1 \n for (; i <= anchors; i++) {\n p.push([diff.x*i + i%2*20, diff.y*i - i%2*20])\n }\n return p\n}","import { lineBuilder } from \"../Builder\"\n\nexport default ({ annotation, start, end, scale = 1 }) => {\n const offset = annotation.position\n if (!start) {\n start = [annotation.dx, annotation.dy]\n } else {\n start = [-end[0] + start[0], -end[1] + start[1]]\n }\n if (!end) {\n end = [annotation.x - offset.x, annotation.y - offset.y]\n }\n\n let x1 = end[0],\n y1 = end[1]\n\n let dx = start[0]\n let dy = start[1]\n\n let size = 10 * scale\n let angleOffset = 16 / 180 * Math.PI\n let angle = Math.atan(dy / dx)\n\n if (dx < 0) {\n angle += Math.PI\n }\n\n const data = [\n [x1, y1],\n [\n Math.cos(angle + angleOffset) * size + x1,\n Math.sin(angle + angleOffset) * size + y1\n ],\n [\n Math.cos(angle - angleOffset) * size + x1,\n Math.sin(angle - angleOffset) * size + y1\n ],\n [x1, y1]\n ]\n\n //TODO add in reverse\n // if (canvasContext.arrowReverse){\n // data = [[x1, y1],\n // [Math.cos(angle + angleOffset)*size, Math.sin(angle + angleOffset)*size],\n // [Math.cos(angle - angleOffset)*size, Math.sin(angle - angleOffset)*size],\n // [x1, y1]\n // ]\n // } else {\n // data = [[x1, y1],\n // [Math.cos(angle + angleOffset)*size, Math.sin(angle + angleOffset)*size],\n // [Math.cos(angle - angleOffset)*size, Math.sin(angle - angleOffset)*size],\n // [x1, y1]\n // ]\n // }\n\n return {\n components: [\n lineBuilder({\n data,\n className: \"connector-end connector-arrow\",\n classID: \"connector-end\"\n })\n ]\n }\n}\n","import { arcBuilder } from \"../Builder\"\n\nexport default ({ line, scale = 1 }) => {\n let dot = arcBuilder({\n className: \"connector-end connector-dot\",\n classID: \"connector-end\",\n data: { radius: 3 * Math.sqrt(scale) }\n })\n dot.attrs.transform = `translate(${line.data[0][0]}, ${line.data[0][1]})`\n\n return { components: [dot] }\n}\n","import { circleHandles } from \"../Handles\"\nimport { arcBuilder } from \"../Builder\"\nimport { event } from \"d3-selection\"\n\nexport default ({ subjectData, type }) => {\n if (!subjectData.radius && !subjectData.outerRadius) {\n subjectData.radius = 20\n }\n\n let handles = []\n const c = arcBuilder({ data: subjectData, className: \"subject\" })\n if (type.editMode) {\n const h = circleHandles({\n r1: c.data.outerRadius || c.data.radius,\n r2: c.data.innerRadius,\n padding: subjectData.radiusPadding\n })\n\n const updateRadius = attr => {\n const r = subjectData[attr] + event.dx * Math.sqrt(2)\n subjectData[attr] = r\n type.redrawSubject()\n type.redrawConnector()\n }\n\n const cHandles = [\n {\n ...h.r1,\n drag: updateRadius.bind(\n type,\n subjectData.outerRadius !== undefined ? \"outerRadius\" : \"radius\"\n )\n }\n ]\n\n if (subjectData.innerRadius) {\n cHandles.push({ ...h.r2, drag: updateRadius.bind(type, \"innerRadius\") })\n }\n handles = type.mapHandles(cHandles)\n }\n\n c.attrs[\"fill-opacity\"] = 0\n\n return { components: [c], handles }\n}\n","import { lineBuilder } from \"../Builder\"\nimport { event } from \"d3-selection\"\n\nexport default ({ subjectData, type }) => {\n if (!subjectData.width) {\n subjectData.width = 100\n }\n if (!subjectData.height) {\n subjectData.height = 100\n }\n\n let handles = []\n let { width, height } = subjectData\n\n const data = [[0, 0], [width, 0], [width, height], [0, height], [0, 0]]\n let rect = lineBuilder({ data, className: \"subject\" })\n\n if (type.editMode) {\n const updateWidth = () => {\n subjectData.width = event.x\n type.redrawSubject()\n type.redrawConnector()\n }\n\n const updateHeight = () => {\n subjectData.height = event.y\n type.redrawSubject()\n type.redrawConnector()\n }\n\n const rHandles = [\n { x: width, y: height / 2, drag: updateWidth.bind(type) },\n { x: width / 2, y: height, drag: updateHeight.bind(type) }\n ]\n\n handles = type.mapHandles(rHandles)\n }\n rect.attrs[\"fill-opacity\"] = 0.1\n return { components: [rect], handles }\n}\n","import { lineBuilder } from '../Builder'\n\n\nexport default ({ subjectData, type }) => {\n const offset = type.annotation.position\n\n let x1 = (subjectData.x1 !== undefined ? subjectData.x1 : offset.x) - offset.x,\n x2 = (subjectData.x2 !== undefined ? subjectData.x2 : offset.x) - offset.x,\n y1 = (subjectData.y1 !== undefined ? subjectData.y1 : offset.y) - offset.y,\n y2 = (subjectData.y2 !== undefined ? subjectData.y2 : offset.y) - offset.y\n\n const data = [[x1, y1], [x2, y2]]\n return { components: [lineBuilder({ data, className : 'subject'})]}\n}","import { lineBuilder, arcBuilder } from \"../Builder\"\nimport { event } from \"d3-selection\"\n\nexport default ({ subjectData = {}, type = {} }, annotation = {}) => {\n const typeSettings = type.typeSettings && type.typeSettings.subject\n\n if (!subjectData.radius) {\n if (typeSettings && typeSettings.radius) {\n subjectData.radius = typeSettings.radius\n } else {\n subjectData.radius = 14\n }\n }\n if (!subjectData.x) {\n if (typeSettings && typeSettings.x) {\n subjectData.x = typeSettings.x\n }\n }\n if (!subjectData.y) {\n if (typeSettings && typeSettings.y) {\n subjectData.y = typeSettings.y\n }\n }\n\n let handles = []\n const components = []\n const radius = subjectData.radius\n const innerRadius = radius * 0.7\n let x = 0\n let y = 0\n\n const notCornerOffset = Math.sqrt(2) * radius\n const placement = {\n xleftcorner: -radius,\n xrightcorner: radius,\n ytopcorner: -radius,\n ybottomcorner: radius,\n xleft: -notCornerOffset,\n xright: notCornerOffset,\n ytop: -notCornerOffset,\n ybottom: notCornerOffset\n }\n\n if (subjectData.x && !subjectData.y) {\n x = placement[`x${subjectData.x}`]\n } else if (subjectData.y && !subjectData.x) {\n y = placement[`y${subjectData.y}`]\n } else if (subjectData.x && subjectData.y) {\n x = placement[`x${subjectData.x}corner`]\n y = placement[`y${subjectData.y}corner`]\n }\n\n const transform = `translate(${x}, ${y})`\n const circlebg = arcBuilder({ className: \"subject\", data: { radius } })\n circlebg.attrs.transform = transform\n circlebg.attrs.fill = annotation.color\n circlebg.attrs[\"stroke-linecap\"] = \"round\"\n circlebg.attrs[\"stroke-width\"] = \"3px\"\n\n const circle = arcBuilder({\n className: \"subject-ring\",\n data: { outerRadius: radius, innerRadius }\n })\n\n circle.attrs.transform = transform\n // circle.attrs.fill = annotation.color\n circle.attrs[\"stroke-width\"] = \"3px\"\n circle.attrs.fill = \"white\"\n\n let pointer\n if (x && y || !x && !y) {\n pointer = lineBuilder({\n className: \"subject-pointer\",\n data: [[0, 0], [x || 0, 0], [0, y || 0], [0, 0]]\n })\n } else if (x || y) {\n const notCornerPointerXY = (v, sign = 1) =>\n v && v / Math.sqrt(2) / Math.sqrt(2) || sign * radius / Math.sqrt(2)\n\n pointer = lineBuilder({\n className: \"subject-pointer\",\n data: [\n [0, 0],\n [notCornerPointerXY(x), notCornerPointerXY(y)],\n [notCornerPointerXY(x, -1), notCornerPointerXY(y, -1)],\n [0, 0]\n ]\n })\n }\n\n if (pointer) {\n pointer.attrs.fill = annotation.color\n pointer.attrs[\"stroke-linecap\"] = \"round\"\n pointer.attrs[\"stroke-width\"] = \"3px\"\n components.push(pointer)\n }\n\n if (type.editMode) {\n const dragBadge = () => {\n subjectData.x =\n event.x < -radius * 2\n ? \"left\"\n : event.x > radius * 2 ? \"right\" : undefined\n subjectData.y =\n event.y < -radius * 2\n ? \"top\"\n : event.y > radius * 2 ? \"bottom\" : undefined\n\n type.redrawSubject()\n }\n\n const bHandles = { x: x * 2, y: y * 2, drag: dragBadge.bind(type) }\n if (!bHandles.x && !bHandles.y) {\n bHandles.y = -radius\n }\n\n handles = type.mapHandles([bHandles])\n }\n\n let text\n if (subjectData.text) {\n text = {\n type: \"text\",\n className: \"badge-text\",\n attrs: {\n fill: \"white\",\n stroke: \"none\",\n \"font-size\": \".7em\",\n text: subjectData.text,\n \"text-anchor\": \"middle\",\n dy: \".25em\",\n x,\n y\n }\n }\n }\n\n components.push(circlebg)\n components.push(circle)\n components.push(text)\n\n return { components, handles }\n}\n","import { select, event } from \"d3-selection\"\nimport { drag } from \"d3-drag\"\nimport { addHandles } from \"./Handles\"\n\n//Note options\nimport noteAlignment from \"./Note/alignment\"\nimport noteVertical from \"./Note/lineType-vertical\"\nimport noteHorizontal from \"./Note/lineType-horizontal\"\n\n//Connector options\nimport connectorLine from \"./Connector/type-line\"\nimport connectorElbow from \"./Connector/type-elbow\"\nimport connectorCurve from \"./Connector/type-curve\"\nimport connectorArrow from \"./Connector/end-arrow\"\nimport connectorDot from \"./Connector/end-dot\"\n\n//Subject options\nimport subjectCircle from \"./Subject/circle\"\nimport subjectRect from \"./Subject/rect\"\nimport subjectThreshold from \"./Subject/threshold\"\nimport subjectBadge from \"./Subject/badge\"\n\nexport class Type {\n constructor({ a, annotation, editMode, dispatcher, notePadding, accessors }) {\n this.a = a\n\n this.note =\n annotation.disable.indexOf(\"note\") === -1 && a.select(\"g.annotation-note\")\n this.noteContent = this.note && a.select(\"g.annotation-note-content\")\n this.connector =\n annotation.disable.indexOf(\"connector\") === -1 &&\n a.select(\"g.annotation-connector\")\n this.subject =\n annotation.disable.indexOf(\"subject\") === -1 &&\n a.select(\"g.annotation-subject\")\n this.dispatcher = dispatcher\n\n if (dispatcher) {\n const handler = addHandlers.bind(null, dispatcher, annotation)\n handler({ component: this.note, name: \"note\" })\n handler({ component: this.connector, name: \"connector\" })\n handler({ component: this.subject, name: \"subject\" })\n }\n\n this.annotation = annotation\n this.editMode = annotation.editMode || editMode\n this.notePadding = notePadding !== undefined ? notePadding : 3\n this.offsetCornerX = 0\n this.offsetCornerY = 0\n\n if (accessors && annotation.data) {\n this.init(accessors)\n }\n }\n\n init(accessors) {\n if (!this.annotation.x) {\n this.mapX(accessors)\n }\n if (!this.annotation.y) {\n this.mapY(accessors)\n }\n }\n\n mapY(accessors) {\n if (accessors.y) {\n this.annotation.y = accessors.y(this.annotation.data)\n }\n }\n\n mapX(accessors) {\n if (accessors.x) {\n this.annotation.x = accessors.x(this.annotation.data)\n }\n }\n\n updateEditMode() {\n this.a.selectAll(\"circle.handle\").remove()\n }\n\n drawOnSVG(component, builders) {\n if (!Array.isArray(builders)) {\n builders = [builders]\n }\n\n builders\n .filter(b => b)\n .forEach(({ type, className, attrs, handles, classID }) => {\n if (type === \"handle\") {\n addHandles({ group: component, r: attrs && attrs.r, handles })\n } else {\n newWithClass(component, [this.annotation], type, className, classID)\n const el = component.select(`${type}.${classID || className}`)\n const addAttrs = Object.keys(attrs)\n const removeAttrs = []\n\n const currentAttrs = el.node().attributes\n for (let i = currentAttrs.length - 1; i >= 0; i--) {\n const name = currentAttrs[i].name\n if (addAttrs.indexOf(name) === -1 && name !== \"class\")\n removeAttrs.push(name)\n }\n\n addAttrs.forEach(attr => {\n if (attr === \"text\") {\n el.text(attrs[attr])\n } else {\n el.attr(attr, attrs[attr])\n }\n })\n\n removeAttrs.forEach(attr => el.attr(attr, null))\n }\n })\n }\n\n //TODO: how to extend this to a drawOnCanvas mode?\n\n getNoteBBox() {\n return bboxWithoutHandles(this.note, \".annotation-note-content text\")\n }\n getNoteBBoxOffset() {\n const bbox = bboxWithoutHandles(this.note, \".annotation-note-content\")\n const transform = this.noteContent.attr(\"transform\").split(/\\(|\\,|\\)/g)\n bbox.offsetCornerX = parseFloat(transform[1]) + this.annotation.dx\n bbox.offsetCornerY = parseFloat(transform[2]) + this.annotation.dy\n bbox.offsetX = this.annotation.dx\n bbox.offsetY = this.annotation.dy\n return bbox\n }\n\n drawSubject(context = {}) {\n const subjectData = this.annotation.subject\n const type = context.type\n const subjectParams = { type: this, subjectData }\n\n let subject = {}\n if (type === \"circle\") subject = subjectCircle(subjectParams)\n else if (type === \"rect\") subject = subjectRect(subjectParams)\n else if (type === \"threshold\") subject = subjectThreshold(subjectParams)\n else if (type === \"badge\")\n subject = subjectBadge(subjectParams, this.annotation)\n\n let { components = [], handles = [] } = subject\n components.forEach(c => {\n if (c && c.attrs && !c.attrs.stroke) {\n c.attrs.stroke = this.annotation.color\n }\n })\n\n if (this.editMode) {\n handles = handles.concat(\n this.mapHandles([{ drag: this.dragSubject.bind(this) }])\n )\n components.push({ type: \"handle\", handles })\n }\n\n return components\n }\n\n drawConnector(context = {}) {\n const connectorData = this.annotation.connector\n const type = connectorData.type || context.type\n const connectorParams = { type: this, connectorData }\n connectorParams.subjectType =\n this.typeSettings &&\n this.typeSettings.subject &&\n this.typeSettings.subject.type\n\n let connector = {}\n if (type === \"curve\") connector = connectorCurve(connectorParams)\n else if (type === \"elbow\") connector = connectorElbow(connectorParams)\n else connector = connectorLine(connectorParams)\n let { components = [], handles = [] } = connector\n const line = components[0]\n //TODO: genericize this into fill t/f stroke t/f\n if (line) {\n line.attrs.stroke = this.annotation.color\n line.attrs.fill = \"none\"\n }\n const endType = connectorData.end || context.end\n let end = {}\n if (endType === \"arrow\") {\n let s = line.data[1]\n const e = line.data[0]\n const distance = Math.sqrt(\n Math.pow(s[0] - e[0], 2) + Math.pow(s[1] - e[1], 2)\n )\n if (distance < 5 && line.data[2]) {\n s = line.data[2]\n }\n end = connectorArrow({\n annotation: this.annotation,\n start: s,\n end: e,\n scale: connectorData.endScale\n })\n } else if (endType === \"dot\") {\n end = connectorDot({ line, scale: connectorData.endScale })\n } else if (!endType || endType === \"none\") {\n this.connector && this.connector.select(\".connector-end\").remove()\n }\n\n if (end.components) {\n end.components.forEach(c => {\n c.attrs.fill = this.annotation.color\n c.attrs.stroke = this.annotation.color\n })\n components = components.concat(end.components)\n }\n\n if (this.editMode) {\n if (handles.length !== 0) components.push({ type: \"handle\", handles })\n }\n return components\n }\n\n drawNote(context = {}) {\n const noteData = this.annotation.note\n const align = noteData.align || context.align || \"dynamic\"\n const noteParams = {\n bbox: context.bbox,\n align,\n offset: this.annotation.offset\n }\n const lineType = noteData.lineType || context.lineType\n let note = {}\n if (lineType === \"vertical\") note = noteVertical(noteParams)\n else if (lineType === \"horizontal\") note = noteHorizontal(noteParams)\n\n let { components = [], handles = [] } = note\n components.forEach(c => {\n c.attrs.stroke = this.annotation.color\n })\n\n if (this.editMode) {\n handles = this.mapHandles([\n { x: 0, y: 0, drag: this.dragNote.bind(this) }\n ])\n components.push({ type: \"handle\", handles })\n\n const dragging = this.dragNote.bind(this),\n start = this.dragstarted.bind(this),\n end = this.dragended.bind(this)\n this.note.call(\n drag()\n .container(select(\"g.annotations\").node())\n .on(\"start\", d => start(d))\n .on(\"drag\", d => dragging(d))\n .on(\"end\", d => end(d))\n )\n } else {\n this.note.on(\"mousedown.drag\", null)\n }\n return components\n }\n\n drawNoteContent(context) {\n const noteData = this.annotation.note\n const padding =\n noteData.padding !== undefined ? noteData.padding : this.notePadding\n let orientation = noteData.orientation || context.orientation || \"topBottom\"\n const lineType = noteData.lineType || context.lineType\n const align = noteData.align || context.align || \"dynamic\"\n\n if (lineType === \"vertical\") orientation = \"leftRight\"\n else if (lineType === \"horizontal\") orientation = \"topBottom\"\n\n const noteParams = {\n padding,\n bbox: context.bbox,\n offset: this.annotation.offset,\n orientation,\n align\n }\n const { x, y } = noteAlignment(noteParams)\n this.offsetCornerX = x + this.annotation.dx\n this.offsetCornerY = y + this.annotation.dy\n this.note && this.noteContent.attr(\"transform\", `translate(${x}, ${y})`)\n\n return []\n }\n\n drawOnScreen(component, drawFunction) {\n return this.drawOnSVG(component, drawFunction)\n }\n\n redrawSubject() {\n this.subject && this.drawOnScreen(this.subject, this.drawSubject())\n }\n\n redrawConnector() {\n this.connector && this.drawOnScreen(this.connector, this.drawConnector())\n }\n\n redrawNote(bbox = this.getNoteBBox()) {\n this.noteContent &&\n this.drawOnScreen(this.noteContent, this.drawNoteContent({ bbox }))\n this.note && this.drawOnScreen(this.note, this.drawNote({ bbox }))\n }\n\n setPosition() {\n const position = this.annotation.position\n this.a.attr(\"transform\", `translate(${position.x}, ${position.y})`)\n }\n\n clearComponents() {\n this.subject && this.subject.select(\"*\").remove()\n this.connector && this.connector.select(\"*\").remove()\n // this.note && this.note.select(\"*\").remove()\n }\n\n setOffset() {\n if (this.note) {\n const offset = this.annotation.offset\n this.note.attr(\"transform\", `translate(${offset.x}, ${offset.y})`)\n }\n }\n\n setPositionWithAccessors(accessors) {\n if (accessors && this.annotation.data) {\n this.mapX(accessors)\n this.mapY(accessors)\n }\n this.setPosition()\n }\n\n setClassName() {\n this.a.attr(\n \"class\",\n `annotation ${this.className && this.className()} ${\n this.editMode ? \"editable\" : \"\"\n } ${this.annotation.className || \"\"}`\n )\n }\n\n draw() {\n this.setClassName()\n this.setPosition()\n this.setOffset()\n this.redrawSubject()\n this.redrawConnector()\n this.redrawNote()\n }\n\n dragstarted() {\n event.sourceEvent.stopPropagation()\n this.dispatcher &&\n this.dispatcher.call(\"dragstart\", this.a, this.annotation)\n this.a.classed(\"dragging\", true)\n this.a.selectAll(\"circle.handle\").style(\"pointer-events\", \"none\")\n }\n dragended() {\n this.dispatcher && this.dispatcher.call(\"dragend\", this.a, this.annotation)\n this.a.classed(\"dragging\", false)\n this.a.selectAll(\"circle.handle\").style(\"pointer-events\", \"all\")\n }\n\n dragSubject() {\n const position = this.annotation.position\n position.x += event.dx\n position.y += event.dy\n this.annotation.position = position\n }\n\n dragNote() {\n const offset = this.annotation.offset\n offset.x += event.dx\n offset.y += event.dy\n this.annotation.offset = offset\n }\n\n mapHandles(handles) {\n return handles.map(h => ({\n ...h,\n start: this.dragstarted.bind(this),\n end: this.dragended.bind(this)\n }))\n }\n}\n\nexport const customType = (initialType, typeSettings, init) => {\n return class customType extends initialType {\n constructor(settings) {\n super(settings)\n this.typeSettings = typeSettings\n\n if (typeSettings.disable) {\n typeSettings.disable.forEach(d => {\n this[d] && this[d].remove()\n\n this[d] = undefined\n if (d === \"note\") {\n this.noteContent = undefined\n }\n })\n }\n }\n\n static init(annotation, accessors) {\n super.init(annotation, accessors)\n if (init) {\n annotation = init(annotation, accessors)\n }\n return annotation\n }\n\n className() {\n return `${typeSettings.className ||\n super.className && super.className() ||\n \"\"}`\n }\n\n drawSubject(context) {\n this.typeSettings.subject = Object.assign(\n {},\n typeSettings.subject,\n this.typeSettings.subject\n )\n return super.drawSubject({ ...context, ...this.typeSettings.subject })\n }\n\n drawConnector(context) {\n this.typeSettings.connector = Object.assign(\n {},\n typeSettings.connector,\n this.typeSettings.connector\n )\n return super.drawConnector({\n ...context,\n ...typeSettings.connector,\n ...this.typeSettings.connector\n })\n }\n\n drawNote(context) {\n this.typeSettings.note = Object.assign(\n {},\n typeSettings.note,\n this.typeSettings.note\n )\n return super.drawNote({\n ...context,\n ...typeSettings.note,\n ...this.typeSettings.note\n })\n }\n\n drawNoteContent(context) {\n return super.drawNoteContent({\n ...context,\n ...typeSettings.note,\n ...this.typeSettings.note\n })\n }\n }\n}\n\nexport class d3NoteText extends Type {\n constructor(params) {\n super(params)\n this.textWrap = params.textWrap || 120\n this.drawText()\n }\n\n updateTextWrap(textWrap) {\n this.textWrap = textWrap\n this.drawText()\n }\n\n //TODO: add update text functionality\n\n drawText() {\n if (this.note) {\n newWithClass(this.note, [this.annotation], \"g\", \"annotation-note-content\")\n\n const noteContent = this.note.select(\"g.annotation-note-content\")\n newWithClass(noteContent, [this.annotation], \"rect\", \"annotation-note-bg\")\n newWithClass(\n noteContent,\n [this.annotation],\n \"text\",\n \"annotation-note-label\"\n )\n newWithClass(\n noteContent,\n [this.annotation],\n \"text\",\n \"annotation-note-title\"\n )\n\n let titleBBox = { height: 0 }\n const label = this.a.select(\"text.annotation-note-label\")\n const wrapLength =\n this.annotation.note && this.annotation.note.wrap ||\n this.typeSettings &&\n this.typeSettings.note &&\n this.typeSettings.note.wrap ||\n this.textWrap\n\n const wrapSplitter =\n this.annotation.note && this.annotation.note.wrapSplitter ||\n this.typeSettings &&\n this.typeSettings.note &&\n this.typeSettings.note.wrapSplitter\n\n let bgPadding =\n this.annotation.note && this.annotation.note.bgPadding ||\n this.typeSettings &&\n this.typeSettings.note &&\n this.typeSettings.note.bgPadding\n\n let bgPaddingFinal = { top: 0, bottom: 0, left: 0, right: 0 }\n if (typeof bgPadding === \"number\") {\n bgPaddingFinal = {\n top: bgPadding,\n bottom: bgPadding,\n left: bgPadding,\n right: bgPadding\n }\n } else if (bgPadding && typeof bgPadding === \"object\") {\n bgPaddingFinal = Object.assign(bgPaddingFinal, bgPadding)\n }\n\n if (this.annotation.note.title) {\n const title = this.a.select(\"text.annotation-note-title\")\n title.text(this.annotation.note.title)\n title.attr(\"fill\", this.annotation.color)\n title.attr(\"font-weight\", \"bold\")\n title.call(wrap, wrapLength, wrapSplitter)\n titleBBox = title.node().getBBox()\n }\n\n label.text(this.annotation.note.label).attr(\"dx\", \"0\")\n label.call(wrap, wrapLength, wrapSplitter)\n\n label.attr(\"y\", titleBBox.height * 1.1 || 0)\n label.attr(\"fill\", this.annotation.color)\n\n const bbox = this.getNoteBBox()\n\n this.a\n .select(\"rect.annotation-note-bg\")\n .attr(\"width\", bbox.width + bgPaddingFinal.left + bgPaddingFinal.right)\n .attr(\n \"height\",\n bbox.height + bgPaddingFinal.top + bgPaddingFinal.bottom\n )\n .attr(\"x\", bbox.x - bgPaddingFinal.left)\n .attr(\"y\", -bgPaddingFinal.top)\n .attr(\"fill\", \"white\")\n .attr(\"fill-opacity\", 0)\n }\n }\n}\n\nexport const d3Label = customType(d3NoteText, {\n className: \"label\",\n note: { align: \"middle\" }\n})\n\nexport const d3Callout = customType(d3NoteText, {\n className: \"callout\",\n note: { lineType: \"horizontal\" }\n})\n\nexport const d3CalloutElbow = customType(d3Callout, {\n className: \"callout elbow\",\n connector: { type: \"elbow\" }\n})\n\nexport const d3CalloutCurve = customType(d3Callout, {\n className: \"callout curve\",\n connector: { type: \"curve\" }\n})\n\nexport const d3Badge = customType(Type, {\n className: \"badge\",\n subject: { type: \"badge\" },\n disable: [\"connector\", \"note\"]\n})\n\nexport const d3CalloutCircle = customType(d3NoteText, {\n className: \"callout circle\",\n subject: { type: \"circle\" },\n note: { lineType: \"horizontal\" },\n connector: { type: \"elbow\" }\n})\n\nexport const d3CalloutRect = customType(d3NoteText, {\n className: \"callout rect\",\n subject: { type: \"rect\" },\n note: { lineType: \"horizontal\" },\n connector: { type: \"elbow\" }\n})\n\nclass ThresholdMap extends d3Callout {\n mapY(accessors) {\n super.mapY(accessors)\n const a = this.annotation\n if ((a.subject.x1 || a.subject.x2) && a.data && accessors.y) {\n a.y = accessors.y(a.data)\n }\n if ((a.subject.x1 || a.subject.x2) && !a.x) {\n a.x = a.subject.x1 || a.subject.x2\n }\n }\n\n mapX(accessors) {\n super.mapX(accessors)\n const a = this.annotation\n if ((a.subject.y1 || a.subject.y2) && a.data && accessors.x) {\n a.x = accessors.x(a.data)\n }\n if ((a.subject.y1 || a.subject.y2) && !a.y) {\n a.y = a.subject.y1 || a.subject.y2\n }\n }\n}\n\nexport const d3XYThreshold = customType(ThresholdMap, {\n className: \"callout xythreshold\",\n subject: { type: \"threshold\" }\n})\n\nexport const newWithClass = (a, d, type, className, classID) => {\n const group = a.selectAll(`${type}.${classID || className}`).data(d)\n group\n .enter()\n .append(type)\n .merge(group)\n .attr(\"class\", className)\n\n group.exit().remove()\n return a\n}\n\nconst addHandlers = (dispatcher, annotation, { component, name }) => {\n if (component) {\n component\n .on(\"mouseover.annotations\", () => {\n dispatcher.call(`${name}over`, component, annotation)\n })\n .on(\"mouseout.annotations\", () =>\n dispatcher.call(`${name}out`, component, annotation)\n )\n .on(\"click.annotations\", () =>\n dispatcher.call(`${name}click`, component, annotation)\n )\n }\n}\n\n//Text wrapping code adapted from Mike Bostock\nconst wrap = (text, width, wrapSplitter, lineHeight = 1.2) => {\n text.each(function() {\n const text = select(this),\n words = text\n .text()\n .split(wrapSplitter || /[ \\t\\r\\n]+/)\n .reverse()\n .filter(w => w !== \"\")\n let word,\n line = [],\n tspan = text\n .text(null)\n .append(\"tspan\")\n .attr(\"x\", 0)\n .attr(\"dy\", 0.8 + \"em\")\n\n while (word = words.pop()) {\n line.push(word)\n tspan.text(line.join(\" \"))\n if (tspan.node().getComputedTextLength() > width && line.length > 1) {\n line.pop()\n tspan.text(line.join(\" \"))\n line = [word]\n tspan = text\n .append(\"tspan\")\n .attr(\"x\", 0)\n .attr(\"dy\", lineHeight + \"em\")\n .text(word)\n }\n }\n })\n}\n\nconst bboxWithoutHandles = (selection, selector = \":not(.handle)\") => {\n if (!selection) {\n return { x: 0, y: 0, width: 0, height: 0 }\n }\n\n return selection\n .selectAll(selector)\n .nodes()\n .reduce(\n (p, c) => {\n const bbox = c.getBBox()\n p.x = Math.min(p.x, bbox.x)\n p.y = Math.min(p.y, bbox.y)\n p.width = Math.max(p.width, bbox.width)\n\n const yOffset = c && c.attributes && c.attributes.y\n p.height = Math.max(\n p.height,\n (yOffset && parseFloat(yOffset.value) || 0) + bbox.height\n )\n return p\n },\n { x: 0, y: 0, width: 0, height: 0 }\n )\n}\n\nexport default {\n Type,\n d3Label,\n d3Callout,\n d3CalloutElbow,\n d3CalloutCurve,\n d3CalloutCircle,\n d3CalloutRect,\n d3XYThreshold,\n d3Badge,\n customType\n}\n","import Annotation from \"./Annotation\"\nimport AnnotationCollection from \"./AnnotationCollection\"\nimport { newWithClass, d3Callout } from \"./Types-d3\"\nimport { select } from \"d3-selection\"\nimport { dispatch } from \"d3-dispatch\"\n\nexport default function annotation() {\n let annotations = [],\n collection,\n context, //TODO: add canvas functionality\n disable = [],\n accessors = {},\n accessorsInverse = {},\n editMode = false,\n ids,\n type = d3Callout,\n textWrap,\n notePadding,\n annotationDispatcher = dispatch(\n \"subjectover\",\n \"subjectout\",\n \"subjectclick\",\n \"connectorover\",\n \"connectorout\",\n \"connectorclick\",\n \"noteover\",\n \"noteout\",\n \"noteclick\",\n \"dragend\",\n \"dragstart\"\n ),\n sel\n\n const annotation = function(selection) {\n sel = selection\n //TODO: check to see if this is still needed\n if (!editMode) {\n selection.selectAll(\"circle.handle\").remove()\n }\n\n const translatedAnnotations = annotations.map(a => {\n if (!a.type) {\n a.type = type\n }\n if (!a.disable) {\n a.disable = disable\n }\n return new Annotation(a)\n })\n\n collection =\n collection ||\n new AnnotationCollection({\n annotations: translatedAnnotations,\n accessors,\n accessorsInverse,\n ids\n })\n\n const annotationG = selection.selectAll(\"g\").data([collection])\n annotationG.enter().append(\"g\").attr(\"class\", `annotations`)\n\n const group = selection.select(\"g.annotations\")\n newWithClass(group, collection.annotations, \"g\", \"annotation\")\n\n const annotation = group.selectAll(\"g.annotation\")\n\n annotation.each(function(d) {\n const a = select(this)\n\n a.attr(\"class\", \"annotation\")\n\n newWithClass(a, [d], \"g\", \"annotation-connector\")\n newWithClass(a, [d], \"g\", \"annotation-subject\")\n newWithClass(a, [d], \"g\", \"annotation-note\")\n newWithClass(\n a.select(\"g.annotation-note\"),\n [d],\n \"g\",\n \"annotation-note-content\"\n )\n d.type =\n d.type.toString() === \"[object Object]\"\n ? d.type\n : new d.type({\n a,\n annotation: d,\n textWrap,\n notePadding,\n editMode,\n dispatcher: annotationDispatcher,\n accessors\n })\n d.type.draw()\n d.type.drawText && d.type.drawText()\n })\n }\n\n annotation.json = function() {\n /* eslint-disable no-console */\n console.log(\n \"Annotations JSON was copied to your clipboard. Please note the annotation type is not JSON compatible. It appears in the objects array in the console, but not in the copied JSON.\",\n collection.json\n )\n /* eslint-enable no-console */\n window.copy(\n JSON.stringify(\n collection.json.map(a => {\n delete a.type\n return a\n })\n )\n )\n return annotation\n }\n\n annotation.update = function() {\n if (annotations && collection) {\n annotations = collection.annotations.map(a => {\n a.type.draw()\n return a\n })\n }\n return annotation\n }\n\n annotation.updateText = function() {\n if (collection) {\n collection.updateText(textWrap)\n annotations = collection.annotations\n }\n return annotation\n }\n\n annotation.updatedAccessors = function() {\n collection.setPositionWithAccessors()\n annotations = collection.annotations\n return annotation\n }\n\n annotation.disable = function(_) {\n if (!arguments.length) return disable\n disable = _\n if (collection) {\n collection.updateDisable(disable)\n annotations = collection.annotations\n }\n return annotation\n }\n\n annotation.textWrap = function(_) {\n if (!arguments.length) return textWrap\n textWrap = _\n if (collection) {\n collection.updateTextWrap(textWrap)\n annotations = collection.annotations\n }\n return annotation\n }\n\n annotation.notePadding = function(_) {\n if (!arguments.length) return notePadding\n notePadding = _\n if (collection) {\n collection.updateNotePadding(notePadding)\n annotations = collection.annotations\n }\n return annotation\n }\n //todo think of how to handle when undefined is sent\n annotation.type = function(_, settings) {\n if (!arguments.length) return type\n type = _\n if (collection) {\n collection.annotations.map(a => {\n a.type.note &&\n a.type.note.selectAll(\"*:not(.annotation-note-content)\").remove()\n a.type.noteContent && a.type.noteContent.selectAll(\"*\").remove()\n a.type.subject && a.type.subject.selectAll(\"*\").remove()\n a.type.connector && a.type.connector.selectAll(\"*\").remove()\n a.type.typeSettings = {}\n a.type = type\n\n a.subject = settings && settings.subject || a.subject\n a.connector = settings && settings.connector || a.connector\n a.note = settings && settings.note || a.note\n })\n\n annotations = collection.annotations\n }\n return annotation\n }\n\n annotation.annotations = function(_) {\n if (!arguments.length)\n return collection && collection.annotations || annotations\n annotations = _\n\n if (collection && collection.annotations) {\n const rerun = annotations.some(\n d => !d.type || d.type.toString() !== \"[object Object]\"\n )\n\n if (rerun) {\n collection = null\n annotation(sel)\n } else {\n collection.annotations = annotations\n }\n }\n return annotation\n }\n\n annotation.context = function(_) {\n if (!arguments.length) return context\n context = _\n return annotation\n }\n\n annotation.accessors = function(_) {\n if (!arguments.length) return accessors\n accessors = _\n return annotation\n }\n\n annotation.accessorsInverse = function(_) {\n if (!arguments.length) return accessorsInverse\n accessorsInverse = _\n return annotation\n }\n\n annotation.ids = function(_) {\n if (!arguments.length) return ids\n ids = _\n return annotation\n }\n\n annotation.editMode = function(_) {\n if (!arguments.length) return editMode\n editMode = _\n\n if (sel) {\n sel.selectAll(\"g.annotation\").classed(\"editable\", editMode)\n }\n\n if (collection) {\n collection.editMode(editMode)\n annotations = collection.annotations\n }\n return annotation\n }\n\n annotation.collection = function(_) {\n if (!arguments.length) return collection\n collection = _\n return annotation\n }\n\n annotation.on = function() {\n const value = annotationDispatcher.on.apply(annotationDispatcher, arguments)\n return value === annotationDispatcher ? annotation : value\n }\n\n return annotation\n}\n","import annotation from './src/Adapter-d3'\nimport { Type, d3Label, d3Callout, d3CalloutCurve, d3CalloutElbow, d3CalloutCircle, \n d3CalloutRect, d3XYThreshold, d3Badge, customType } from './src/Types-d3'\n\nexport {\n annotation,\n Type as annotationTypeBase ,\n d3Label as annotationLabel ,\n d3Callout as annotationCallout ,\n d3CalloutCurve as annotationCalloutCurve ,\n d3CalloutElbow as annotationCalloutElbow ,\n d3CalloutCircle as annotationCalloutCircle ,\n d3CalloutRect as annotationCalloutRect ,\n d3XYThreshold as annotationXYThreshold ,\n d3Badge as annotationBadge ,\n customType as annotationCustomType \n}\n\nexport default {\n annotation,\n annotationTypeBase : Type,\n annotationLabel : d3Label,\n annotationCallout : d3Callout,\n annotationCalloutCurve : d3CalloutCurve,\n annotationCalloutElbow : d3CalloutElbow,\n annotationCalloutCircle : d3CalloutCircle,\n annotationCalloutRect : d3CalloutRect,\n annotationXYThreshold : d3XYThreshold,\n annotationBadge : d3Badge,\n annotationCustomType : customType\n}"],"names":["Annotation","x","y","nx","ny","dy","dx","color","data","type","subject","connector","note","disable","id","className","_dx","undefined","_dy","_x","_y","_color","_className","_type","setPosition","selectAll","nodes","length","redrawSubject","clearComponents","setOffset","redrawConnector","redrawNote","setClassName","updatePosition","updateOffset","json","Object","keys","AnnotationCollection","annotations","accessors","accessorsInverse","newSettings","forEach","d","setPositionWithAccessors","editMode","a","updateEditMode","remove","textWrap","updateTextWrap","drawText","notePadding","map","k","getNoteBBoxOffset","positionX","positionY","pointHandle","cx","cy","move","circleHandles","r1","r2","padding","h","Math","sqrt","addHandles","group","handles","r","enter","append","attr","call","drag","container","select","node","on","start","end","exit","leftRightDynamic","align","topBottomDynamic","orientationTopBottom","orientationLeftRight","bbox","width","height","orientation","offset","indexOf","lineBuilder","curve","curveLinear","canvasContext","classID","lineGen","line","builder","context","pathMethods","attrs","arcBuilder","arcShape","arc","innerRadius","outerRadius","radius","startAngle","endAngle","PI","components","lineSetup","subjectType","annotation","position","x1","x2","y1","y2","subjectData","angle","asin","radiusPadding","abs","cos","sin","connectorData","diffY","diffX","xe","ye","opposite","acos","points","createPoints","curveCatmullRom","cHandles","c","i","index","updatePoint","event","mapHandles","bind","anchors","diff","p","push","scale","size","angleOffset","atan","dot","transform","updateRadius","rect","updateWidth","updateHeight","rHandles","typeSettings","notCornerOffset","placement","circlebg","fill","circle","pointer","notCornerPointerXY","v","sign","dragBadge","bHandles","text","Type","dispatcher","noteContent","handler","addHandlers","component","name","offsetCornerX","offsetCornerY","init","mapX","mapY","builders","Array","isArray","filter","b","el","addAttrs","removeAttrs","currentAttrs","attributes","bboxWithoutHandles","split","parseFloat","offsetX","offsetY","subjectParams","subjectCircle","subjectRect","subjectThreshold","subjectBadge","stroke","concat","dragSubject","connectorParams","connectorCurve","connectorElbow","connectorLine","endType","s","e","distance","pow","connectorArrow","endScale","connectorDot","noteData","noteParams","lineType","noteVertical","noteHorizontal","dragNote","dragging","dragstarted","dragended","noteAlignment","drawFunction","drawOnSVG","drawOnScreen","drawSubject","drawConnector","getNoteBBox","drawNoteContent","drawNote","sourceEvent","stopPropagation","classed","style","customType","initialType","settings","babelHelpers.get","babelHelpers.extends","d3NoteText","params","titleBBox","label","wrapLength","wrap","wrapSplitter","bgPadding","bgPaddingFinal","top","bottom","left","right","title","getBBox","d3Label","d3Callout","d3CalloutElbow","d3CalloutCurve","d3Badge","d3CalloutCircle","d3CalloutRect","ThresholdMap","d3XYThreshold","newWithClass","merge","lineHeight","each","words","reverse","w","word","tspan","pop","join","getComputedTextLength","selection","selector","reduce","min","max","yOffset","value","collection","ids","annotationDispatcher","dispatch","sel","translatedAnnotations","annotationG","toString","draw","log","copy","JSON","stringify","update","updateText","updatedAccessors","_","arguments","updateDisable","updateNotePadding","rerun","some","apply"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAqBA;4BAiBhB;sBAfDC,CAeC;QAfDA,CAeC,0BAfG,CAeH;sBAdDC,CAcC;QAdDA,CAcC,0BAdG,CAcH;QAbDC,EAaC,QAbDA,EAaC;QAZDC,EAYC,QAZDA,EAYC;uBAXDC,EAWC;QAXDA,EAWC,2BAXI,CAWJ;uBAVDC,EAUC;QAVDA,EAUC,2BAVI,CAUJ;0BATDC,KASC;QATDA,KASC,8BATO,MASP;QARDC,IAQC,QARDA,IAQC;QAPDC,IAOC,QAPDA,IAOC;QANDC,OAMC,QANDA,OAMC;QALDC,SAKC,QALDA,SAKC;QAJDC,IAIC,QAJDA,IAIC;QAHDC,OAGC,QAHDA,OAGC;QAFDC,EAEC,QAFDA,EAEC;QADDC,SACC,QADDA,SACC;;;SACIC,GAAL,GAAWb,OAAOc,SAA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