OSDN Git Service

tweak jump position on resizing ThreadView (minor change commit b0a4289c9e1c8a8f1f2b4...
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Wed, 12 Dec 2007 16:12:57 +0000 (01:12 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Wed, 12 Dec 2007 16:12:57 +0000 (01:12 +0900)
src/FukuiNoNamari/thread_view.py

index a098e76..0c7b300 100644 (file)
@@ -213,17 +213,21 @@ class ThreadView(gtk.HBox):
 
             # before relayout, find top layout on gdkwindow
             top_layout = None
+            delta = 0
             for lay in self.pangolayout:
                 if lay.posY > self.adjustment.value:
                     break
                 top_layout = lay
 
+            if top_layout is not None:
+                delta = top_layout.posY - self.vscrollbar.get_value()
+
             self.relayout()
             self.drawingarea_prev_width = event.width
 
             # after relayout, set vscrollbar.value to top layout's posY
             if top_layout is not None:
-                self.vscrollbar.set_value(top_layout.posY)
+                self.vscrollbar.set_value(top_layout.posY - delta)
 
         self.adjustment.page_size = self.drawingarea.allocation.height
         self.vscrollbar.set_increments(20, self.drawingarea.allocation.height)