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 Nacho <Ig...@cern.ch> on 2004/07/08 14:45:42 UTC

Canvas -> deselectAll Problem

Hello,

I have a weird problem with JSVGCanvas and text selection.

I have a piece of code that highlights a text node using the code:

Mark startMark = textNode.getMarkerForChar(aci.getBeginIndex(), true);
Mark endMark = textNode.getMarkerForChar(aci.getEndIndex(), false);

svgCanvas.select(startMark, endMark);

This highlights the text. It would come back to its non-highlighted 
status using:

svgCanvas.deselectAll();

This code worked perfectly with Batik 1.5, but the 
svgCanvas.deselectAll() doesn't have any effect with Batik 1.5.1 libraries.
The code is the same, but with the old distribution of libraries it 
works, while with the new it doesn't.

Reading the changes, I see in Batik 1.5.1 README.txt "Clearing text 
selection now works".

What can be the cause of that? Maybe some errors were solved with the 
new release, but it is supposed to be used diferently?

Thanks in advance for any replay,

Ignacio Leon



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


Re: Canvas -> deselectAll Problem

Posted by Thomas DeWeese <Th...@Kodak.com>.
Nacho wrote:

> Yes, it works with that small change, thanks for the advice.
> Am I right to assume that this bug will be corrected in next version?

    Yes, it should be.

> Thomas DeWeese wrote:
> 
>> Hi Nacho,
>>
>>    This is a bug I think, 'svgCanvas.select' goes through a route
>> that fails to set 'selectedNode' in the
>> org.apache.batik.gvt.text.ConcreteTextSelector.  As a result
>> when you ask to clear the selection it thinks it doesn't have
>> one.
>>
>>    If you are up for a small code change I think you can fix this
>> easily, just add:
>>
>>         selectionNode = node;
>>
>>    at line 153 in ConcreteTextSelector.
>>
>>    Let me know if this does or doesn't work for you.
>>
>>
>>
>> Nacho wrote:
>>
>>> Hello,
>>>
>>> I have a weird problem with JSVGCanvas and text selection.
>>>
>>> I have a piece of code that highlights a text node using the code:
>>>
>>> Mark startMark = textNode.getMarkerForChar(aci.getBeginIndex(), true);
>>> Mark endMark = textNode.getMarkerForChar(aci.getEndIndex(), false);
>>>
>>> svgCanvas.select(startMark, endMark);
>>>
>>> This highlights the text. It would come back to its non-highlighted 
>>> status using:
>>>
>>> svgCanvas.deselectAll();
>>>
>>> This code worked perfectly with Batik 1.5, but the 
>>> svgCanvas.deselectAll() doesn't have any effect with Batik 1.5.1 
>>> libraries.
>>> The code is the same, but with the old distribution of libraries it 
>>> works, while with the new it doesn't.
>>>
>>> Reading the changes, I see in Batik 1.5.1 README.txt "Clearing text 
>>> selection now works".
>>>
>>> What can be the cause of that? Maybe some errors were solved with the 
>>> new release, but it is supposed to be used diferently?
>>>
>>> Thanks in advance for any replay,
>>>
>>> Ignacio Leon
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>
> 


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


Re: Canvas -> deselectAll Problem

Posted by Nacho <Ig...@cern.ch>.
Hello Thomas,

Yes, it works with that small change, thanks for the advice.
Am I right to assume that this bug will be corrected in next version?

Cheers,

Nacho


Thomas DeWeese wrote:

> Hi Nacho,
>
>    This is a bug I think, 'svgCanvas.select' goes through a route
> that fails to set 'selectedNode' in the
> org.apache.batik.gvt.text.ConcreteTextSelector.  As a result
> when you ask to clear the selection it thinks it doesn't have
> one.
>
>    If you are up for a small code change I think you can fix this
> easily, just add:
>
>         selectionNode = node;
>
>    at line 153 in ConcreteTextSelector.
>
>    Let me know if this does or doesn't work for you.
>
>
>
> Nacho wrote:
>
>> Hello,
>>
>> I have a weird problem with JSVGCanvas and text selection.
>>
>> I have a piece of code that highlights a text node using the code:
>>
>> Mark startMark = textNode.getMarkerForChar(aci.getBeginIndex(), true);
>> Mark endMark = textNode.getMarkerForChar(aci.getEndIndex(), false);
>>
>> svgCanvas.select(startMark, endMark);
>>
>> This highlights the text. It would come back to its non-highlighted 
>> status using:
>>
>> svgCanvas.deselectAll();
>>
>> This code worked perfectly with Batik 1.5, but the 
>> svgCanvas.deselectAll() doesn't have any effect with Batik 1.5.1 
>> libraries.
>> The code is the same, but with the old distribution of libraries it 
>> works, while with the new it doesn't.
>>
>> Reading the changes, I see in Batik 1.5.1 README.txt "Clearing text 
>> selection now works".
>>
>> What can be the cause of that? Maybe some errors were solved with the 
>> new release, but it is supposed to be used diferently?
>>
>> Thanks in advance for any replay,
>>
>> Ignacio Leon
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>

-- 

 -------------------------------------------------------------------------------
 Ignacio Leon 
 
 CERN -- European Laboratory for Particle Physics
 IT/CS  Network Services and Operation
 Mailbox: G23910
 CH-1211 Genève 23, Switzerland 
 Office : (+41) (0) 22 76 75 590          
 Ignacio.Leon@cern.ch 
 -------------------------------------------------------------------------------


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


Re: Canvas -> deselectAll Problem

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Nacho,

    This is a bug I think, 'svgCanvas.select' goes through a route
that fails to set 'selectedNode' in the
org.apache.batik.gvt.text.ConcreteTextSelector.  As a result
when you ask to clear the selection it thinks it doesn't have
one.

    If you are up for a small code change I think you can fix this
easily, just add:

         selectionNode = node;

    at line 153 in ConcreteTextSelector.

    Let me know if this does or doesn't work for you.



Nacho wrote:

> Hello,
> 
> I have a weird problem with JSVGCanvas and text selection.
> 
> I have a piece of code that highlights a text node using the code:
> 
> Mark startMark = textNode.getMarkerForChar(aci.getBeginIndex(), true);
> Mark endMark = textNode.getMarkerForChar(aci.getEndIndex(), false);
> 
> svgCanvas.select(startMark, endMark);
> 
> This highlights the text. It would come back to its non-highlighted 
> status using:
> 
> svgCanvas.deselectAll();
> 
> This code worked perfectly with Batik 1.5, but the 
> svgCanvas.deselectAll() doesn't have any effect with Batik 1.5.1 libraries.
> The code is the same, but with the old distribution of libraries it 
> works, while with the new it doesn't.
> 
> Reading the changes, I see in Batik 1.5.1 README.txt "Clearing text 
> selection now works".
> 
> What can be the cause of that? Maybe some errors were solved with the 
> new release, but it is supposed to be used diferently?
> 
> Thanks in advance for any replay,
> 
> Ignacio Leon
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


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