// changes here only affect runtime
lively.morphic.World.addMethods({
windowBounds: function () {
if (this.cachedWindowBounds) return this.cachedWindowBounds;
var canvas = this.renderContext().getMorphNode(),
topmost = document.documentElement,
body = document.body,
scale = 1 / this.getScale(),
topLeft = pt(body.scrollLeft - (canvas.offsetLeft || 0), body.scrollTop - (canvas.offsetTop || 0)),
width, height;
if (UserAgent.isTouch){
width = window.innerWidth * scale;
height = window.innerHeight * scale;
} else {
width = topmost.clientWidth * scale;
height = topmost.clientHeight * scale;
}
return this.cachedWindowBounds = topLeft.scaleBy(scale).extent(pt(width, height));
}
});