Hi Geoff,

Thanks, it helped a lot.

I actually had some problems because I have several texts to show, so
the onActivate() was deciding the id of the text shown on the current
screen.

The onTrack() later needs to annotate the tracking values together with
the text id.

But then I moved all the code of the onActivate() to the setupRender()
and passed the text id as a parameter of the ZoneUpdater
(ZoneUpdater.userStageId="${userStage.userStageId}"):

<p class="paragraph" t:type="any" t:mixins="zoneUpdater" 
ZoneUpdater.clientEvent="mousemove" ZoneUpdater.event="track" 
        ZoneUpdater.zone="textZone" 
ZoneUpdater.userStageId="${userStage.userStageId}" 
ZoneUpdater.fields="['documentHeightVal', 
        'documentWidthVal', 'windowHeightVal', 'windowWidthVal', 
'windowOffsetYVal', 'windowOffsetXVal', 'mouseYVal',
        'mouseXVal', 'domPathVal', 'overTextVal']">${currentParagraph}</p>

That worked. I tried to do the same thing passing the text id to another
input hidden like the rest, but it didn't work.

Now I have to do some extra work in the onTrack(), but it is not as much
as the one being done in the setupRender().

El 07/04/17 a las 15:12, JumpStart escribió:
> I’ll answer it this way:
>
>       
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3
>  
> <http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3>
>
> Hope this helps,
>
> Geoff
>
>> On 7 Apr 2017, at 2:07 PM, Phyambre <phy....@gmail.com> wrote:
>>
>> Hi,
>>
>> I would like to do mouse tracking with tapestry (know the coordinates of
>> the mouse, the path of the DOM tree to the element that is being pointed
>> and the text of that element).
>>
>> Currently I have a solution that works, but I think it is terribly
>> inefficient and I hope you can make any suggestions to improve it.
>>
>> I have a JS library that calculates all those values and writes them to
>> "input hidden" form fields in my .tml
>>
>> Then I used the ZoneUpdater mixin:
>>
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/onevent
>>
>> I modified ZoneUpdater.java by adding a List attribute. That list will
>> contain the ids of the "input hidden fields" as you can see below.
>>
>> Then, in the TML file, instead of
>>
>> |<input t:type="TextField" t:id="firstName" t:mixins="zoneUpdater"
>> t:clientEvent="keyup" t:event="firstNameChanged" t:zone="nameZone" /><br/>|
>>
>> I have
>>
>> <p class="paragraph" t:type="any" t:mixins="zoneUpdater"
>> ZoneUpdater.clientEvent="mousemove" ZoneUpdater.event="track"
>>            ZoneUpdater.zone="textZone"
>> ZoneUpdater.fields="['documentHeightVal', 'documentWidthVal',
>> 'windowHeightVal',
>>            'windowWidthVal', 'windowOffsetYVal', 'windowOffsetXVal',
>> 'mouseYVal','mouseXVal', 'domPathVal',
>> 'overTextVal']">${currentParagraph}</p>
>>
>> then in zone-updater.js I add all those values to the URL.
>>
>> Finally, in my page file, the onTrack() method is executed.
>>
>> The problem here is that onActivate() is also being exectued, and
>> onActivate() has a lot of stuff that I want to execute only once (when
>> the page loads) and not every time the user moves the mouse.
>>
>> Is there any other solution that does not trigger onActivate() every
>> time that the user moves the mouse on a component?
>>
>> Regards,
>>
>> Phy.
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to