noreply at rubyforge.org
2007-Oct-02 13:12 UTC
[wxruby-development] [ wxruby-Patches-14375 ] bigdemo/wxScrolledWindow - paint bug with scrolled window
Patches item #14375, was opened at 2007-10-02 13:12
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=220&aid=14375&group_id=35
Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Christopher Bludau (count_cb)
Assigned to: Nobody (None)
Summary: bigdemo/wxScrolledWindow - paint bug with scrolled window
Initial Comment:
I found a bug in bigdemo/wxScrolledWindow.rbw
When you scroll the window and then draw with the mouse the lines
aren''t drawn at the correct position. After a repaint the lines are
drawn correctly.
So they are saved correctly to the lines array but there is an error when they
are first drawn.
I changed two methods to get the correct behaviour:
(file with changes attached)
From:
def on_left_button_event_down(event)
if event.left_is_down() and !@drawing
set_focus()
set_XY(event)
@curLine = []
capture_mouse()
@drawing = true
end
end
To:
def on_left_button_event_down(event)
if event.left_is_down() and !@drawing
set_focus()
set_XY(event)
@event_x_old = event.get_x # added this to save the current absolute...
@event_y_old = event.get_y # ... mouse position
@curLine = []
capture_mouse()
@drawing = true
end
end
----
And in on_left_button_event_motion
From:
paint do | dc |
dc.set_pen(Wx::Pen.new("MEDIUM FOREST GREEN", 4, Wx::SOLID))
coords = [@x, @y] + convert_event_coords(event)
@curLine.push(coords)
coords.flatten!()
dc.draw_line(coords[0], coords[1], coords[2], coords[3])
set_XY(event)
end
To:
paint do | dc |
dc.set_pen(Wx::Pen.new("MEDIUM FOREST GREEN", 4, Wx::SOLID))
save_coords = [@x, @y] + convert_event_coords(event) # translate
the absolute coords to save them in the array
coords = [@event_x_old, @event_y_old, event.get_x, event.get_y] # the
absolute coords to use for the first draw
@curLine.push(save_coords) # use the
translated coords here
coords.flatten!()
dc.draw_line(coords[0], coords[1], coords[2], coords[3]) # and the
absolute coords here
set_XY(event)
@event_x_old = event.get_x # saving the
new ...
@event_y_old = event.get_y # ...
absolute coords
end
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=220&aid=14375&group_id=35
Maybe Matching Threads
- [993] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Use ClientDC via Window#paint object
- [976] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Remove deprecated begin_drawing and end_drawing calls
- wxScrolledWindow.rbw
- [823] trunk/wxruby2/doc/textile: Remove docs for some deprecated classes
- Parser For Line Number Tracing
