You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Shekhar Bhati <sh...@gmail.com> on 2009/09/18 10:50:52 UTC

Canvas not getting active at run time

Hi Batik Eperts,

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.
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.

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.

Thanks & regards,
Shekhar

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Canvas not getting active at run time

Posted by th...@kodak.com.
Hi Shekhar,

Shekhar Bhati <sh...@gmail.com> wrote on 09/18/2009 09:34:24 AM:

> We are setting the width and height of the canvas with setAttributeNS 
methods.

    This must be done in the update manager's thread.

> We have a framework consisting of JSPs and javascripts.
> We have embedded SVG tags inside JSP using our graphics framework.
> So we are handling these prioperties (like height and width) inside
> the javascript.
> So SVG document is rendered through JSP.

   I don't know much of anything about JSP.  So I'm not sure if/how
you would resize the canvas.

> When the document is rendered and we see the image on the screen , at
> that time only that area which we can see is active but when we try to
> zoomout,pan or scroll, only then the new area appeared is not active .

   How do you pan?  Using the Scrollbars?  When you say 'not active' 
is stuff drawn or do you get blank screen in the new areas.

> At tht time when I refreshes the document then it gets active.
> So probably the new area is not getting active at runtime.
> 
> What happens when we scroll or pan or zoomout? I mean is there
> something in JSVGViewer class( we have inherited it) or in the applet
> , which is called while performing these functions, so I will try
> putting that code inside UpdateManager thread.

    The JSVGScrollPane changes the rendering transform on the
JSVGCanvas (setRenderingTransform).  The Batik components obviously
follow the needed rules when doing this.

> On Fri, Sep 18, 2009 at 6:41 PM,  <th...@kodak.com> wrote:
> > Hi Shekhar,
> >
> > Shekhar Bhati <sh...@gmail.com> wrote on 09/18/2009 09:03:55 
AM:
> >
> >> We have this applet inside a jsp and we are setting the size by using
> >> setAttributeNS("","height",..);
> >
> >    Setting the size of what?
> >
> >> When I increase the size of the frame the new area which appears is
> >> not active but when I refersh the page ,then it gets active so I
> >> thought probably the canvas resizing is not happening at runtime so I
> >> thought of updatemanager thread.
> >
> >     Is stuff being rendered in the new area?  In squiggle the
> > canvas resizes as needed for the frame, perhaps you should look
> > at that code? (batik.apps.svgbrowser)
> >
> >     Really I'm not going to be able to help you without a better
> > description of what you are doing.
> >
> >
> >> Please suggest.
> >>
> >>
> >> On Fri, Sep 18, 2009 at 4:04 PM,  <th...@kodak.com> wrote:
> >> > Hi Shekhar,
> >> >
> >> > Shekhar Bhati <sh...@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...
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: 
batik-users-unsubscribe@xmlgraphics.apache.org
> >> For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> >>
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


Re: Canvas not getting active at run time

Posted by Shekhar Bhati <sh...@gmail.com>.
Hi Thomas,

We are setting the width and height of the canvas with setAttributeNS methods.
We have a framework consisting of JSPs and javascripts.
We have embedded SVG tags inside JSP using our graphics framework.
So we are handling these prioperties (like height and width) inside
the javascript.
So SVG document is rendered through JSP.
When the document is rendered and we see the image on the screen , at
that time only that area which we can see is active but when we try to
zoomout,pan or scroll, only then the new area appeared is not active .
At tht time when I refreshes the document then it gets active.
So probably the new area is not getting active at runtime.

What happens when we scroll or pan or zoomout? I mean is there
something in JSVGViewer class( we have inherited it) or in the applet
, which is called while performing these functions, so I will try
putting that code inside UpdateManager thread.

On Fri, Sep 18, 2009 at 6:41 PM,  <th...@kodak.com> wrote:
> Hi Shekhar,
>
> Shekhar Bhati <sh...@gmail.com> wrote on 09/18/2009 09:03:55 AM:
>
>> We have this applet inside a jsp and we are setting the size by using
>> setAttributeNS("","height",..);
>
>    Setting the size of what?
>
>> When I increase the size of the frame the new area which appears is
>> not active but when I refersh the page ,then it gets active so I
>> thought probably the canvas resizing is not happening at runtime so I
>> thought of updatemanager thread.
>
>     Is stuff being rendered in the new area?  In squiggle the
> canvas resizes as needed for the frame, perhaps you should look
> at that code? (batik.apps.svgbrowser)
>
>     Really I'm not going to be able to help you without a better
> description of what you are doing.
>
>
>> Please suggest.
>>
>>
>> On Fri, Sep 18, 2009 at 4:04 PM,  <th...@kodak.com> wrote:
>> > Hi Shekhar,
>> >
>> > Shekhar Bhati <sh...@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...
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Canvas not getting active at run time

Posted by th...@kodak.com.
Hi Shekhar,

Shekhar Bhati <sh...@gmail.com> wrote on 09/18/2009 09:03:55 AM:

> We have this applet inside a jsp and we are setting the size by using
> setAttributeNS("","height",..);

   Setting the size of what?

> When I increase the size of the frame the new area which appears is
> not active but when I refersh the page ,then it gets active so I
> thought probably the canvas resizing is not happening at runtime so I
> thought of updatemanager thread.

    Is stuff being rendered in the new area?  In squiggle the
canvas resizes as needed for the frame, perhaps you should look
at that code? (batik.apps.svgbrowser)

    Really I'm not going to be able to help you without a better
description of what you are doing.


> Please suggest.
> 
> 
> On Fri, Sep 18, 2009 at 4:04 PM,  <th...@kodak.com> wrote:
> > Hi Shekhar,
> >
> > Shekhar Bhati <sh...@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...
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


Re: Canvas not getting active at run time

Posted by Shekhar Bhati <sh...@gmail.com>.
Hi Thomas,

We have this applet inside a jsp and we are setting the size by using
setAttributeNS("","height",..);
When I increase the size of the frame the new area which appears is
not active but when I refersh the page ,then it gets active so I
thought probably the canvas resizing is not happening at runtime so I
thought of updatemanager thread.
Please suggest.


On Fri, Sep 18, 2009 at 4:04 PM,  <th...@kodak.com> wrote:
> Hi Shekhar,
>
> Shekhar Bhati <sh...@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...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Canvas not getting active at run time

Posted by th...@kodak.com.
Hi Shekhar,

Shekhar Bhati <sh...@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...