dragging a rotated element

Game development with Board Game Arena Studio
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: dragging a rotated element

Post by Victoria_La »

I remember few games, but I am not sure if they have drag though. Kingdomino and Isaac, in issac it does not really drag but it follow mouse coursor rotated, I still don't see how it won't work if you use vanila js/html stuff except is transform is used during drag as well (and it does not stack)
What is you game name - I can clone it to look
User avatar
galehar
Posts: 136
Joined: 29 March 2015, 00:12

Re: dragging a rotated element

Post by galehar »

It's race for the galaxy, but the access is restricted. However, as I've just mentioned, Steam Works features the same bug.
User avatar
shadowphiar
Posts: 124
Joined: 01 January 2017, 16:07

Re: dragging a rotated element

Post by shadowphiar »

galehar wrote: 02 February 2021, 12:15
shadowphiar wrote: 02 February 2021, 10:58 You can drag rotated elements in Steam Works (although its fairly rare - only a couple of tiles ever rotate). I didn't have any similar problem with rotated elements disappearing and didn't do anything special to counter it ¯\_(ツ)_/¯ (the code uses draggable, but if you look at it beware I had to customise it quite severely to cope with some z-ordering issues.)
Have you tried it in chrome? I just did, and you have the exact same bug as I do. Once the tile is rotated, if you try to drag it, it disappears.
Oh! I'd better have a look at that then. (Development was mostly in Safari, with some Firefox, Chrome and Edge for testing, but perhaps I never did that particular operation in that browser. As I said, it's fairly rare). I'll let you know if I discover anything helpful.
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: dragging a rotated element

Post by Victoria_La »

I found a bug in draggable which is currently only exists in studio deployed code, I sent email to admins, stay tunned.
User avatar
shadowphiar
Posts: 124
Joined: 01 January 2017, 16:07

Re: dragging a rotated element

Post by shadowphiar »

Yes... during onMouseDown it's trying to work out whether this element (or its parents) is being zoomed in by a css transformation, but its method of doing this is naive at best.

As a workaround until the underlying bug is fixed, it appears to be safe to set

Code: Select all

this.zoomFactorOriginalElement = 1;
inside your onStartDragging function, unless you're actually using css zooming on that element in which case you might have to adjust for that. Note though that the zooming of the whole interface which is applied automatically to small windows, doesn't have to be accounted for here as this function is only looking at parent elements up to `game_play_area`)
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: dragging a rotated element

Post by Een »

Victoria_La wrote: 03 February 2021, 02:20 I found a bug in draggable which is currently only exists in studio deployed code, I sent email to admins, stay tunned.
I have used Victoria_La's proposal for a quick workaround on this, and pushed a new version on the studio (not in prod).
I tested quickly locally, but I didn't write this component and I'm not completely sure about the usecase. So please let me know if it solves the issue referenced in this thread (and doesn't break anything).
User avatar
shadowphiar
Posts: 124
Joined: 01 January 2017, 16:07

Re: dragging a rotated element

Post by shadowphiar »

Hi Een, yes I think the change works and would be safe for any rotation, scale or translate transform.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: dragging a rotated element

Post by Een »

shadowphiar wrote: 05 February 2021, 11:41 Hi Een, yes I think the change works and would be safe for any rotation, scale or translate transform.
Thanks! Then it will be included in our next release.
User avatar
galehar
Posts: 136
Joined: 29 March 2015, 00:12

Re: dragging a rotated element

Post by galehar »

Thanks Een!
Same here, it does fix the bug and I haven't seen any issue.
Is there a date for the next release? Because there is a workaround and I'm wondering if I should bother releasing it in prod.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: dragging a rotated element

Post by Een »

galehar wrote: 05 February 2021, 11:53 Thanks Een!
Same here, it does fix the bug and I haven't seen any issue.
Is there a date for the next release? Because there is a workaround and I'm wondering if I should bother releasing it in prod.
Usually once per week (but not a golden rule). Next one most likely next Thursday.
(and thanks should go mostly to Victoria_La ;) )
Post Reply

Return to “Developers”