google-code-export / labyrinth

Automatically exported from code.google.com/p/labyrinth
GNU General Public License v2.0
2 stars 0 forks source link

Images and Drawings disappear when moved vertically out of bound #135

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a mindmap
2. Add a drawing (or an image)
3. Move the drawing upward so that the upper edge of the drawing lies
outside the upper edge of the visible area (I.E. the main white rectangluar
area where I can put texts/drawings/images in).

What is the expected output? What do you see instead?
- The expected result is that the upper half of the drawing goes out of the
visible area while the lower half is still visible.
- And what actually happened is that the entire drawing disappeared as soon
as the upper edge of the drawing goes vertically outside the visible area.

What version of the product are you using? On what operating system?
labyrinth 0.4.0 provided in the Fedora 10 i386 distribution

Please provide any additional information below.
- The drawing does not disappear if moved horizontally out of bound.
- When exported as image(whole map or only visible area), everything is normal.

Original issue reported on code.google.com by wks1...@gmail.com on 15 Feb 2009 at 9:56

Attachments:

GoogleCodeExporter commented 9 years ago
Let me answer my own question.
I inspected the source-code and found this:
(MMapArea.py line 735+)

for t in self.thoughts:
    try:
        if t.lr[0] >= ax and t.ul[0] <= ax + width and t.lr[1] <= ay +
height and t.ul[1] >= ay:
            t.draw (context)
    except:
        t.draw(context)

Look at the "if" condition: it seems that the x and y coordinate are handled
differently.  This should be the bug.

A quick fix is to change that line into:
if t.lr[0] >= ax and t.ul[0] <= ax + width and t.lr[1] >= ay and t.ul[1] <= ay +
height:

I prefer this method (but may be slower):
if max(t.ul[0],ax)<=min(t.lr[0],ax+width) and
max(t.ul[1],ay)<=min(t.lr[1],ay+height0):

Original comment by wks1...@gmail.com on 16 Feb 2009 at 3:07

GoogleCodeExporter commented 9 years ago
fixed in revision 346. Thanks for your patch.

Original comment by sinfr...@gmail.com on 26 Feb 2009 at 10:01