From 79437a6ab81112438373a6010030ef504ffd5deb Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sat, 7 Feb 2015 12:19:01 +0100 Subject: make the redraw code shorter --- objects.js | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'objects.js') diff --git a/objects.js b/objects.js index c0e4dfc..af21b6d 100644 --- a/objects.js +++ b/objects.js @@ -4437,30 +4437,14 @@ StageMorph.prototype.drawNew = function () { StageMorph.prototype.drawOn = function (aCanvas, aRect) { var map = document.getElementById('map'); - var rectangle, area, delta, src, w, h, sl, st; - if (!this.isVisible) { - return null; - } + var rectangle, area; rectangle = aRect || this.bounds; area = rectangle.intersect(this.bounds).round(); - if (area.extent().gt(new Point(0, 0))) { - delta = this.position().neg(); - src = area.copy().translateBy(delta).round(); - - sl = src.left(); - st = src.top(); - w = Math.min(src.width(), this.image.width - sl); - h = Math.min(src.height(), this.image.height - st); - - if (w < 1 || h < 1) { - return null; - } - map.style.width = this.dimensions.x * this.scale + 'px'; - map.style.height = this.dimensions.y * this.scale + 'px'; - map.style.left = area.left() + 'px'; - map.style.top = area.top() + 'px'; - window.map.invalidateSize(); - } + map.style.width = this.dimensions.x * this.scale + 'px'; + map.style.height = this.dimensions.y * this.scale + 'px'; + map.style.left = area.left() + 'px'; + map.style.top = area.top() + 'px'; + window.map.invalidateSize(); }; StageMorph.prototype.clearPenTrails = function () { -- cgit v1.3.1