Expand my Community achievements bar.

SharedCursorPane and relative size

Avatar

Level 3
Hello,



Something i realised with SharedCursorPane is that if user A
has an available board size of 1000 X 500 and B has 500 X 250 when
user A place his mouse in the middle of his board it will appears
to be also in the middle of B.

A user pointing to a square at position 5,5 which is still
5,5 on B will have the cursor on B pointing to 10,10.

Kind of problematic when trying to show what you are doing
and the other user pointing to something else.



I could not see any options to make it absolute (px based),
is there a use case for piggybacking with the sharedCursorPane ?



Thanks,



Greg





8 Replies

Avatar

Former Community Member
Hi Greg,

Yes currently we pass the value of the cursor relative to the
width and height i.e. when we pass the over the network, we pass
currentXPosition/CurrentWidth, and currentYPosition/CurrentHeight
and when we receive we multiply the values with the respective
width and height to get the relative position.

If you want to put absolute position, I will say you override
the function sendMyCursor and onItemReceive in SharedCursorPane and
pass and receive the absolute values instead of the relative ones.
I haven't tried it myself but these are the places where we do
these calculations and send relative values.

One thing is, you need to make sure when you receive absolute
values, if it's more than the current User's width and height then
you might have to filter them out.



Hope this helps.

Thanks

Hironmay Basu

Avatar

Former Community Member


Yup, agree w/ Hironmay - it should be pretty easy to create
a subclass that does absolute positioning (this one used to at one
point). Maybe it makes sense to include both "modes" in the
cursorpane - we'll look into that.



thanks

nigel

Avatar

Level 3
It was indeed very simple, thanks !

Avatar

Former Community Member
great! On our part, we will def look into possibility of
adding both options for future.



Thanks

Hironmay Basu

Avatar

Former Community Member
Update: SharedCursorPane will now support both modes
--absolute and relative and it will be updated in the next SDK
drop.



Thanks

Hironmay Basu

Avatar

Level 3
hi,

apologies for butting in on this topic but I have some
questions too. I ran into the same issue as coulix in that the
position of the pointer was off by a certain amount. In particular
I could 'see' a user's cursor moving on the shared whiteboard but
the shape then seemed to appear offset from that position.



What's the best practice for resolving this? Obviously we'd
always like the cursor position to be correct, ie when you 'point'
at a spot on the screen it should be correct to everyone connected,
regardless of screen size. Is it as simple as using absolute
positioning? I realise that smaller screens may cut portions off
the stage off but that's unavoidable I guess. If the answer is yes,
could you elaborate on how relative positioning is useful? I'm not
quite clear how to make use of it if it means running the risk of
offsets for certain users.



Lastly, is it relative to the stage size, meaning that
anytime we use percentage based layouts it is likely to be
encountering the issue of observing offsets?



Sorry about all the questions.



Cheers



Stefan















Avatar

Former Community Member
Hi,



We send the relative position of the pointer i.e.
currentMouseX/Width and currentMouseY/Height in the relative case.
And on the client side , we calculate back using the Width and
Height . Here Width and Height is the width and height of
SharedCursorPane which is a UIComponent.



I didn't get the line

>>In particular I could 'see' a user's cursor moving on
the shared whiteboard but the shape then seemed to appear offset
from that position.



What we send is the mousePosition of users and it has nothing
to do with any shape coordinates.

However, you have the complete control of whether you want
to use absolute/relative positions based on your situation. I am
not sure if I understand your question very correctly but if you
give me a specific case, then I can be even more specific about the
way to go.



Lastly, we currently use relative positioning as default
case, since it offsets the various width/height of different client
cursor panes and gives the similar mouse position relative to their
pane.



Thanks

Hironmay Basu

Avatar

Level 3
thanks for following up. Let me try and clarify.



Say I have this code inside my session tag:

<mx:Canvas width="100%" height="100%"
creationComplete="buildModel()">

<rtc:SimpleChat width="100" height="400" />

<rtc:Roster id="userList" width="100" height="400"
showMenuButtons="false" displaySelection="true" />

<rtc:SharedWhiteBoard width="100%" height="100%"
backgroundAlpha="0" />

</mx:Canvas>



The main app is set to 100% w and h, and so is the canvas and
whiteboard. Now have a look at
this
file
and
this
one
, note how the pointer is incorrect (I am not using any
custom code). Also note that the shapes appear to be drawn in the
correct position, but the cursor of the person drawing the shape
seems to actually draw it at a different point (the cursor appears
a few pixels offset from where the shape actually appears).



Is this expected behaviour? Or should this behaviour be
automatically corrected by the methods you desribed which take
width and height into account, meaning could this be a bug? It
certainly will confuse users if positions are incorrect. I'm just
looking for some advice best practices, basically I think the
positioning should always be logically correct. Can and how can we
achieve that?



thanks



Stefan