New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbols #115
Symbols #115
Conversation
This reverts commit cf17c05.
…s + react to HackbrettXXX's comments
src/svg2pdf.js
Outdated
@@ -279,6 +279,12 @@ SOFTWARE. | |||
_pdf.beginFormObject(bBox[0], bBox[1], bBox[2], bBox[3], tfMatrix); | |||
renderChildren(node, _pdf.unitMatrix, this, false, false, AttributeState.default()); | |||
_pdf.endFormObject(node.getAttribute("id")); | |||
} else if (nodeIs(node, "symbol,svg")) { | |||
// create unclipped and untransformed form object | |||
var bBox = getUntransformedBBox(node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use a larger bBox here. At least in the svg case, this is the box determined by width/height or the viewBox.
src/svg2pdf.js
Outdated
@@ -846,7 +871,7 @@ SOFTWARE. | |||
]; | |||
} | |||
|
|||
if (!nodeIs(node, "marker,svg,g")) { | |||
if (!nodeIs(node, "marker,svg,g")) { // TODO: and !symbol ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add symbol to the list ;)
src/svg2pdf.js
Outdated
@@ -863,6 +888,20 @@ SOFTWARE. | |||
return boundingBox; | |||
}; | |||
|
|||
var getBoundingBoxByChildren = function (node) { | |||
boundingBox = [0, 0, 0, 0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var boundingBox = ...
tests/symbols/spec.svg
Outdated
@@ -0,0 +1,16 @@ | |||
<svg id="svgElement" width="500" height="500" xmlns="http://www.w3.org/2000/svg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add more cases:
- different transforms (on the
symbol
, on theuse
, "around" theuse
, ...) - style inheritance from "around" the
use
element
tests/symbols/spec.svg
Outdated
@@ -0,0 +1,16 @@ | |||
<svg id="svgElement" width="500" height="500" xmlns="http://www.w3.org/2000/svg"> | |||
<symbol id="myDot" x="1" height="100" viewBox="0 0 80 100" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1px is really hard to see, make it e.g. 10px to really see an effect.
tests/symbols/spec.svg
Outdated
<circle cx="50" cy="50" r="50"/> | ||
</symbol> | ||
|
||
<use href="#myDot" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you could align the circles a little better and make them distinguishable, so it's immediately clear which circle is which.
…entation attribute), styling
This reverts commit 29eb4ea.
# Conflicts: # src/applyparseattributes.ts # src/context/referenceshandler.ts # src/nodes/geometrynode.ts # src/nodes/image.ts # src/nodes/renderednode.ts # src/nodes/svgnode.ts # src/nodes/text.ts # src/nodes/use.ts # src/utils/bbox.ts # src/utils/node.ts # test/common/tests.js # test/specs/complete-computer-network/reference.pdf # test/specs/image-svg-urls/reference.pdf # test/specs/references/reference.pdf
- don't add line width to bounding boxes, - refactor referenced handler (externalize rendering of referenced elements) - fix <use> viewBox transformations - hotfix pattern x/y offset
Implement symbols an update -handling; closes #110