Fix scroll positions for CanvasRenderer (Fix #1259)

This commit is contained in:
Niklas von Hertzen 2017-12-07 16:36:09 +08:00
parent 8b653f89bc
commit ef5c59e26d
3 changed files with 18 additions and 3 deletions

View File

@ -1,8 +1,9 @@
### Changelog ###
#### v1.0.0-alpha2 - TBD ####
* Fix `data-html2canvas-ignore` attribute
* Fix decimal `letter-spacing` values
* Fix scroll positions for CanvasRenderer (#1259)
* Fix `data-html2canvas-ignore` attribute (#1253)
* Fix decimal `letter-spacing` values (#1293)
#### v1.0.0-alpha1 - 5.12.2017 ####
* Complete rewrite of library

View File

@ -253,7 +253,7 @@ export class DocumentCloner {
}
this.inlineAllImages(clone);
if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
this.scrolledElements.push([node, node.scrollLeft, node.scrollTop]);
this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
}
switch (node.nodeName) {
case 'CANVAS':

View File

@ -65,6 +65,20 @@
</div>
</div>
<div style="overflow:scroll; height: 100px;" id="scroll">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s
with the release of <div style="border-width:10px 0 5px 0;background:green;">a</div>Letraset sheets containing Lorem Ipsum passages, <img src="../../assets/image.jpg" /> and more recently with desktop publishing software like <b>Aldus PageMaker</b> including versions of Lorem Ipsum.
<div style="overflow:visible;position:relative;"><u>position:relative within a overflow:hidden element</u><br /> <br />
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like <b>Aldus PageMaker</b> including versions of Lorem Ipsum.
</div>
<script>
document.querySelector('#scroll').scrollTo(0, 200);
</script>
</div>
</body>
</html>