UX: do not update window's contents when window is too small
authorJan Vrany <jan.vrany@labware.com>
Thu, 05 Aug 2021 22:30:35 +0100
changeset 228 757414c2bd1e
parent 227 6ad3604ea78a
child 229 229ed681f4aa
UX: do not update window's contents when window is too small Consider application's window as NOT visible if either width or height is very small (5 pixels and less). This helps to prevent useless updates when window is in resizing panel and splitter is moved to the edge. In that case, window is not practically visible, but technically it is still `#shown` and has `#width` or `#height` of 1 pixel.
VDBAbstractApplication.st
--- a/VDBAbstractApplication.st	Thu Aug 05 13:54:13 2021 +0100
+++ b/VDBAbstractApplication.st	Thu Aug 05 22:30:35 2021 +0100
@@ -292,9 +292,14 @@
         ^ self.
     ].
     changedObject == window ifTrue:[         
-        aspect == #visibility ifTrue:[
-            windowVisible ~~ window shown ifTrue:[ 
-                windowVisible := window shown.
+        (aspect == #visibility or:[aspect == #sizeOfView]) ifTrue:[
+            | windowVisibleNow |
+
+            windowVisibleNow := window shown 
+                                    and: [ window width > 5
+                                    and: [ window height > 5 ] ].
+            windowVisible ~~ windowVisibleNow ifTrue:[ 
+                windowVisible := windowVisibleNow.
                 self updateAfterWindowVisibilityChanged.
             ]. 
 
@@ -305,6 +310,7 @@
     super update:aspect with:aParameter from:changedObject
 
     "Modified: / 07-10-2018 / 22:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-08-2021 / 22:25:23 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 updateAfterWindowVisibilityChanged