Ryan Blazecka wrote:
> I have made two changes to our version of floatcanvas that I think would 
> be worth adding to the trunk. both are related to objects becoming very 
> small on-screen because of being zoomed way out.

Thanks for the patches.

> the first change is to the Rectangle object. currently, when rectangle 
> objects are zoomed out so that their width or height are <1, they 
> disappear. perhaps this is intended,

well, it's not so much intended, as a side effect of the fact that sizes 
are truncated to ints, and <1 goes to zero. However, you are right that 
some applications might want it to disappear, and some not.


>     def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
>         ( XY, WH ) = self.SetUpDraw(dc,
>                                     WorldToPixel,
>                                     ScaleWorldToPixel,
>                                     HTdc)
>         if WH[0] == 0 or WH[1] == 0:              # NEW
>             dc.DrawLinePoint(XY, XY + WH)         # NEW
>         else:                                     # NEW
>             dc.DrawRectanglePointSize(XY, WH)     # OLD, BUT NOW INDENTED
>         if HTdc and self.HitAble:
>             HTdc.DrawRectanglePointSize(XY, WH)

I'm thinking I should put this in, but have a settable parameter for 
"minimum size" or something that could be 1, or zero, or... In that 
case, I'd still have it draw a rectangle of width or height 1 -- or did 
you try that and it didn't work?

> the second change is to ScaledText objects. even worse than the 
> rectangle behaviour, when these are zoomed down to 1 pixel or less, the 
> text gets drawn "full-size" (feels like 12 point or so). this clearly 
> seems like a bug to me,

I don't see that on OS-X what version of wxPython and OS are you 
running? I suspect it is a bug with what happens when you pass in 0 for 
a text size.

>     def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
>         (X,Y) = WorldToPixel( (self.XY) )
> 
>         # compute the font size:
>         Size = abs( ScaleWorldToPixel( (self.Size, self.Size) )[1] ) # 
> only need a y coordinate length
>         ## Check to see if the font size is large enough to blow up the 
> X font server
>         ## If so, limit it. Would it be better just to not draw it?
>         ## note that this limit is dependent on how much memory you 
> have, etc.
>         Size = min(Size, self.MaxFontSize)
>         if Size < 2:                  # NEW
>             return                    # NEW
>         self.SetFont(Size, self.Family, self.Style, self.Weight, 
> self.Underlined, self.FaceName)

I'll put this change in, as I can't imagine it would cause harm, though 
it would be better to set a MinSize, I suppose...

> I would 
> have rather included a proper "patch", but I am using windows, and don't 
> have any patch tools available to me. let me know if you'd rather I 
> track those down and do it properly.

This is fine. In fact, probably easier, as  a patch may not work against 
my working copy.

If you ever do want to do a patch, do it against the version in the 
wxPython SVN -- it's under "3rdParty":

  http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/FloatCanvas/

> thanks again for creating floatcanvas!

You're welcome.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to