Roassal2: Camera scale callback?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal2: Camera scale callback?

Jan Blizničenko
Hello

In our Roassal 2 based app, we would like to have current zoom displayed. We need to change the value when camera scale changes. Maybe I could make events for all possible sources of zooming, but it seems pretty error-prone and I did not find a way to do it for RTZoomableView source.
Therefore, I think we need something like "TRCameraScaleCallback", or any idea how to do it other way.

Thank you
Jan Blizničenko
Reply | Threaded
Open this post in threaded view
|

Re: Roassal2: Camera scale callback?

abergel
Hi Jan!

This is an excellent point you are making! Such a mechanism will enable an additional kind of interaction (e.g., semantic zooming). This was on my todo list of long. Your email pushed this todo at the top of my todo stack.

I have updated Roassal with such a callback. Here is an example:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
TRCameraTest>>testScale
        | callback t |
        callback := TRCameraScaleCallback new.
        t := 0.
        callback block: [ :newScale | t := t + 1 ].
        camera addCallback: callback.
        self assert: t equals: 0.
       
        camera scale: 0.5.
        self assert: t equals: 1.

        camera scale: 10.
        self assert: t equals: 2.
       
        camera scale: 11.
        self assert: t equals: 3.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Things to keep in mind:
 - you need to register the callback in the camera
 - if your callback changes something on the view, you may need to use #signalUpdate (although I haven’t tried).


Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



> On Nov 6, 2014, at 7:22 PM, Jan B. <[hidden email]> wrote:
>
> Hello
>
> In our Roassal 2 based app, we would like to have current zoom displayed. We
> need to change the value when camera scale changes. Maybe I could make
> events for all possible sources of zooming, but it seems pretty error-prone
> and I did not find a way to do it for RTZoomableView source.
> Therefore, I think we need something like "TRCameraScaleCallback", or any
> idea how to do it other way.
>
> Thank you
> Jan Blizničenko
>
>
>
> --
> View this message in context: http://forum.world.st/Roassal2-Camera-scale-callback-tp4788816.html
> Sent from the Moose mailing list archive at Nabble.com.
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal2: Camera scale callback?

Jan Blizničenko
It works exactly as I wished for, thanks a lot!

Jan

abergel wrote
Hi Jan!

This is an excellent point you are making! Such a mechanism will enable an additional kind of interaction (e.g., semantic zooming). This was on my todo list of long. Your email pushed this todo at the top of my todo stack.

I have updated Roassal with such a callback. Here is an example:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
TRCameraTest>>testScale
        | callback t |
        callback := TRCameraScaleCallback new.
        t := 0.
        callback block: [ :newScale | t := t + 1 ].
        camera addCallback: callback.
        self assert: t equals: 0.
       
        camera scale: 0.5.
        self assert: t equals: 1.

        camera scale: 10.
        self assert: t equals: 2.
       
        camera scale: 11.
        self assert: t equals: 3.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Things to keep in mind:
 - you need to register the callback in the camera
 - if your callback changes something on the view, you may need to use #signalUpdate (although I haven’t tried).


Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



> On Nov 6, 2014, at 7:22 PM, Jan B. <[hidden email]> wrote:
>
> Hello
>
> In our Roassal 2 based app, we would like to have current zoom displayed. We
> need to change the value when camera scale changes. Maybe I could make
> events for all possible sources of zooming, but it seems pretty error-prone
> and I did not find a way to do it for RTZoomableView source.
> Therefore, I think we need something like "TRCameraScaleCallback", or any
> idea how to do it other way.
>
> Thank you
> Jan Blizničenko
>
>
>
> --
> View this message in context: http://forum.world.st/Roassal2-Camera-scale-callback-tp4788816.html
> Sent from the Moose mailing list archive at Nabble.com.
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev