Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Don't apply clipping for the root element.
Browse files Browse the repository at this point in the history
The idea is that the root element coincides with the canvas, so anything
outside the bounds of the root element would be outside the canvas
anyway. This isn't quite true in the fancy of fancy CSS transforms, but
it's true in normal cases. Mainly, it works around a bug in html2canvas
where parent clipping regions are applied incorrectly when rendering
child elements. In TerriaJS, this manifests as point markers (e.g. in
`#test`'s TerriaJS Test Data -> GeoJSON -> Test overriding styled and
unstyled features) not showing up in the generated image. More details
of the html2canvas issue can be found here:
niklasvh#1084
  • Loading branch information
kring committed Apr 22, 2018
1 parent 9a6e57a commit 9b084ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/NodeContainer.js
Expand Up @@ -215,7 +215,9 @@ export default class NodeContainer {
}
}
getClipPaths(): Array<Path> {
const parentClips = this.parent ? this.parent.getClipPaths() : [];
// No need to clip to the parent if the parent is the root.
const hasParentAndParentIsNotRoot = this.parent && this.parent.parent;
const parentClips = hasParentAndParentIsNotRoot ? this.parent.getClipPaths() : [];
const isClipped = this.style.overflow !== OVERFLOW.VISIBLE;

return isClipped
Expand Down

0 comments on commit 9b084ba

Please sign in to comment.