d3-svg-annotation
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -525,3 +525,3 @@ import { event, select } from 'd3-selection'; | ||
var x = -bbox.x; | ||
var y = -bbox.y; | ||
var y = 0; //-bbox.y | ||
if (orientationTopBottom.indexOf(orientation) !== -1) { | ||
@@ -1080,3 +1080,3 @@ align = topBottomDynamic(align, offset.x); | ||
this.editMode = annotation.editMode || editMode; | ||
this.notePadding = notePadding || 3; | ||
this.notePadding = notePadding !== undefined ? notePadding : 3; | ||
this.offsetCornerX = 0; | ||
@@ -1174,7 +1174,2 @@ this.offsetCornerY = 0; | ||
} | ||
// getConnectorBBox() { return bboxWithoutHandles(this.connector)} | ||
// getSubjectBBox() { return bboxWithoutHandles(this.subject)} | ||
// getAnnotationBBox() { return bboxWithoutHandles(this.a)} | ||
}, { | ||
@@ -1277,3 +1272,3 @@ key: 'drawSubject', | ||
var noteData = this.annotation.note; | ||
var padding = noteData.padding || this.notePadding; | ||
var padding = noteData.padding !== undefined ? noteData.padding : this.notePadding; | ||
var orientation = noteData.orientation || context.orientation || 'topBottom'; | ||
@@ -1505,3 +1500,3 @@ var lineType = noteData.lineType || context.lineType; | ||
var title = this.a.select('text.annotation-note-title'); | ||
title.text(this.annotation.note.title).attr('dy', '1.1em'); | ||
title.text(this.annotation.note.title); | ||
title.call(wrap, wrapLength); | ||
@@ -1511,3 +1506,3 @@ titleBBox = title.node().getBBox(); | ||
label.text(this.annotation.note.label).attr('dy', '1em').attr('dx', '0'); | ||
label.text(this.annotation.note.label).attr('dx', '0'); | ||
label.call(wrap, wrapLength); | ||
@@ -1621,15 +1616,11 @@ | ||
var wrap = function wrap(text, width) { | ||
var lineHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1.2; | ||
text.each(function () { | ||
var text = select(this), | ||
words = text.text().split(/[ \t\r\n]+/).reverse(), | ||
words = text.text().split(/[ \t\r\n]+/).reverse(); | ||
// lineNumber = 0, | ||
lineHeight = .2, | ||
//ems | ||
// y = text.attr("y"), | ||
dy = parseFloat(text.attr("dy")) || 0; | ||
var word = void 0, | ||
line$$1 = [], | ||
tspan = text.text(null).append("tspan").attr("x", 0).attr("dy", dy + "em"); | ||
tspan = text.text(null).append("tspan").attr("x", 0).attr("dy", .8 + "em"); | ||
@@ -1643,3 +1634,3 @@ while (word = words.pop()) { | ||
line$$1 = [word]; | ||
tspan = text.append("tspan").attr("x", 0).attr("dy", lineHeight + dy + "em").text(word); | ||
tspan = text.append("tspan").attr("x", 0).attr("dy", lineHeight + "em").text(word); | ||
} | ||
@@ -1662,3 +1653,5 @@ } | ||
p.width = Math.max(p.width, bbox.width); | ||
p.height += bbox.height; | ||
var yOffset = c && c.attributes && c.attributes.y; | ||
p.height = Math.max(p.height, (yOffset && parseFloat(yOffset.value) || 0) + bbox.height); | ||
return p; | ||
@@ -1726,3 +1719,3 @@ }, { x: 0, y: 0, width: 0, height: 0 }); | ||
d.type = new d.type({ a: a, annotation: d, textWrap: textWrap, notePadding: notePadding, editMode: editMode, | ||
d.type = !d.type.name ? d.type : new d.type({ a: a, annotation: d, textWrap: textWrap, notePadding: notePadding, editMode: editMode, | ||
dispatcher: annotationDispatcher, accessors: accessors }); | ||
@@ -1729,0 +1722,0 @@ d.type.draw(); |
{ | ||
"name": "d3-svg-annotation", | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "indexRollup.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
974789
14402