Commit 881e430c authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix previous effort to make svg width/height/viewBox int only

parent d8a175a5
......@@ -3582,27 +3582,26 @@ function do_getscroll(cid) {
height = bbox.y > 0 ? bbox.y + bbox.height : bbox.height;
if (width === 0) {
width = patchwin[cid].window.document.body.clientWidth;
// Convert to int by dropping everything after the decimal place.
// Previously I was having trouble with the DOM height and width
// setters having a different precision than the viewBox, leading
// to a subtle rendering bug.
// Since the patchsvg isn't going to be transformed at all, ints
// should work just fine here.
width |= 0;
}
if (height === 0) {
height = patchwin[cid].window.document.body.clientHeight;
height |= 0;
}
// Since we don't do any transformations on the patchsvg,
// let's try just using ints for the height/width/viewBox
// to keep things simple.
width |= 0; // drop everything to the right of the decimal point
height |= 0;
configure_item(svg, {
viewBox: [bbox.x > 0 ? 0 : bbox.x,
bbox.y > 0 ? 0 : bbox.y,
width,
height]
.join(" ")
.join(" "),
width: width,
height: height
});
svg.width.baseVal.valueAsString = width;
svg.height.baseVal.valueAsString = height;
// svg.width.baseVal.valueAsString = width;
// svg.height.baseVal.valueAsString = height;
// console.log("x is " + bbox.x);
// console.log("y is " + bbox.x);
// console.log("width is " + bbox.width);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment