UIObjectView.st
changeset 2482 62831852b487
parent 2481 b8999543e2b4
child 2485 59ecb1305177
--- a/UIObjectView.st	Wed Mar 25 14:05:57 2009 +0100
+++ b/UIObjectView.st	Wed Mar 25 14:25:27 2009 +0100
@@ -1452,7 +1452,48 @@
     relOrgX := relOrg x - bwWidth.
     relOrgY := relOrg y - bwWidth.
     width   := aView width  + bwWidth + bwWidth.
-    height  := aView height + bwWidth + bwWid
+    height  := aView height + bwWidth + bwWidth.
+
+    size to:1 by:-1 do:[:anIndex|
+        damage := theDamages at:anIndex.
+
+        "/ compute the rectangle into the view
+        y := damage top  - relOrgY.
+        x := damage left - relOrgX.
+        w := damage width.
+        h := damage height.
+
+        isRepaired := true.
+
+        x     < 0      ifTrue:[ w := w + x. x := 0. isRepaired := false ].
+        y     < 0      ifTrue:[ h := h + y. y := 0. isRepaired := false ].
+        x + w > width  ifTrue:[ w := width  - x.    isRepaired := false ].
+        y + h > height ifTrue:[ h := height - y.    isRepaired := false ].
+
+        (w > 0 and:[h > 0]) ifTrue:[
+            bwWidth ~~ 0 ifTrue:[
+                color isNil ifTrue:[
+                    "/ must force redraw of border
+                    color := aView borderColor.
+                    aView borderColor:(Color colorId:1).
+                    aView borderColor:color.
+                ].
+                w := w - bwWidth.
+                h := h - bwWidth.
+
+                (x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0].
+                (y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0].
+
+                (w > 0 and:[h > 0])  ifFalse:[w := 0].
+            ].
+
+            w > 0 ifTrue:[
+                aView clearRectangleX:x y:y width:w height:h.
+                aView exposeX:x y:y width:w height:h
+            ].
+            isRepaired ifTrue:[ theDamages removeIndex:anIndex ].
+        ]
+    ].
 !
 
 selection