mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-13 16:33:28 -04:00
Use a different strategy to determine canvas size for invisible canvases.
This commit is contained in:
parent
eec7209a5c
commit
bac579d85b
1 changed files with 7 additions and 4 deletions
|
@ -49,9 +49,9 @@ var View = this.View = Base.extend({
|
|||
var that = this;
|
||||
DomEvent.add(window, {
|
||||
resize: function(event) {
|
||||
// Only get canvas offset if it's not invisible (size is
|
||||
// 0, 0), as otherwise the offset would be wrong.
|
||||
if (!DomElement.getSize(canvas).equals([0, 0]))
|
||||
// Only get canvas offset if it's not invisible, as
|
||||
// otherwise the offset would be wrong.
|
||||
if (!DomElement.isInvisible(canvas))
|
||||
offset = DomElement.getOffset(canvas);
|
||||
// Set the size now, which internally calls onResize
|
||||
that.setViewSize(
|
||||
|
@ -66,7 +66,10 @@ var View = this.View = Base.extend({
|
|||
}
|
||||
});
|
||||
} else {
|
||||
size = Size.create(canvas.offsetWidth, canvas.offsetHeight);
|
||||
size = DomElement.isInvisible(canvas)
|
||||
? Size.create(parseInt(canvas.getAttribute('width')),
|
||||
parseInt(canvas.getAttribute('height')))
|
||||
: DomElement.getSize(canvas);
|
||||
}
|
||||
// TODO: Test this on IE:
|
||||
if (canvas.attributes.stats) {
|
||||
|
|
Loading…
Reference in a new issue