xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Canvas not getting active at run time
Date Fri, 18 Sep 2009 10:34:27 GMT
Hi Shekhar,

Shekhar Bhati <shekhar.bhati@gmail.com> wrote on 09/18/2009 04:50:52 AM:

> I am facing an issue with activating the canvas on frame resizing.
> I am using batik to show complex images for my application. Here I 
> have some objects for which I have a functionality of 
> highlight/unhighlight the objects. It works like when I click on 
> the object, it gets highlighted and when I click anywhere on the 
> background it gets unhighlighted.

   How do you receive the click events on the 'background'?  Normally
this is done by having a 'white' or transparent rectangle that covers
the entire canvas as the first thing in the SVG file (so it's "below"
everything else).

> We have inherited the class JSVGScrollPane for scrollbars as we have
> huge images.
> The issue is that ,the area which I can see on the first go is active
> , but when I scroll(pan/zoom out) then the new area which appears is
> not active, to make it active I have to refresh the page, so the
> unhighlight does not work on that area which appears after scrolling
> the page.

    It sounds like your background rect for handling unselect doesn't
cover the entire contents of the canvas.  This is fairly easy to test
by simply 'tinting' your background rectangle so you can see it. 
My guess is that you are using x="0" y="0" width="100%" height="100%" 
as the size of the rectangle - this will cover the 'initial' viewport 
but as you scroll or pan in/out it won't cover the full screen anymore.

    The correct thing would be to calculate the actual dimensions of 
the document and use that to populate the rectangle dimensions.  The
simple thing to do is use something like:
         'x="-5000%" y="-5000%" width="10000%" height="10000%"'

> I have heard about the update manager thread and also used it at many
> places , but here I am not getting which code to put inside
> UpdateManager thread to make this hidden area active on scrolling at
> runtime.

    I don't think this is your problem.  You could potentially use
the UpdateManager to update your background rectangles position/size
on scroll/zoom...

View raw message