xReference, yReference whackiness

Hi John,
I spent a couple hours this weekend tinkering with this, and it’s definitely odd. I suspect there’s some quirky behavior in the xReference and yReference properties only when the object is scaled, but my research hasn’t yet pinpointed this as the issue. I don’t recall mention of this anytime in the past 1-1.5 years, so I’m trying to figure out what’s going on.

If you don’t mind me asking, could you explain exactly what your scenario/goal is and how it should function? From your previous description, it sounds that you’re aiming to have individual “objects” that the user can scale/rotate via pinch-zoom and move about the scene. Will these objects be in separate display layers? You mentioned the usage of groups, so I imagine that is true.

Will you be implementing the physics engine for any reason? I might have a potential solution for you that doesn’t involve xReference and yReference, but it depends on the goal here.

Thanks for being patient here, hopefully I can help you resolve this.
Brent [import]uid: 200026 topic_id: 34591 reply_id: 138944[/import]

Thanks so much for the quick response, Brent.

Your description is exactly correct…the user must be able to click and drag objects as well as size them. The bottom-most object is no different, however because it encompasses all the other objects, the effect is a zoom.

There will not be any physics applied, so definitely let me know your thoughts.

Thanks so much again, I appreciate it.

-John [import]uid: 193702 topic_id: 34591 reply_id: 138954[/import]

Hi Brent, sorry to be a pest, do you have any new information on this issue? I’m jammed up at the moment on this, hoping to hear more about your work-around.

Thanks!
-John [import]uid: 193702 topic_id: 34591 reply_id: 139333[/import]

Hi John,
Don’t worry, you’re not being a “pest”. :slight_smile: I just have a pile of other projects that I’m digging through this week and probably next…

One thing I determined is that xReference and yReference don’t -appear- to be working properly when scaling is performed. My testing has narrowed it down to that. I still don’t know if I’m doing something wrong or not… could be my approach, but could also be a bug. I intend to submit this project as an actual bug report into the system, but that could take some time to resolve.

My current idea, since you’re using display groups (and no physics) is to scale your objects at the -group- level, with center reference, while shifting the object in the opposite direction of the touch offset. So, for example, if you have a square at 0,0 and you want to scale around the point at -100,-100 (in its relative local coordinates), you might move the entire group by -100,-100, while offsetting the square itself by 100,100 (thus, it’s as if you’re sliding the group “underneath” the square, then you scale the group by its center reference point).

I need to do some testing on this, as it’s only a theory at this point. As for your master background scaling every piece that sits atop it, that should be fine if you scale the entire stage (or parent group) of all the sub-groups that contain pieces.

I apologize for this apparent bug, and I intend to submit it a.s.a.p.

Brent [import]uid: 200026 topic_id: 34591 reply_id: 139351[/import]

Hi Brent,

Thanks for getting back to me so quickly. I had tried the technique you describe, but I didn’t spend a lot of time on that approach…I must have bungled the implementation, I’ll give it another shot.

In my experience with this issue, the xReference and yReference DO appear to be working correctly, even with scaling, but only after the object jumps to some new location. After it jumps, I can zoom it up and down ad infinitum, and it stays locked on the xRef/yRef point.

-John [import]uid: 193702 topic_id: 34591 reply_id: 139354[/import]

Hi John,
I researched your issue a bit more. The core engineers are evaluating the “order” in which some of these object interactions occur, and how it can be fixed to be more logical and user-friendly. So the issue is known, but I don’t yet know the end solution.

In the meantime, my suggestion of scaling/shifting around a “center point” using display groups was confirmed as a good and logical way to go, if you can get the shift and offset math working properly.

Atop that, I just posted a comprehensive guest tutorial about pinch-zoom-rotate. This is from the same author (Matt Webster) as the previous code share demo that (I think) you sampled, but this one is far more comprehensive. I didn’t write it, but I’ve tested it and it might work nicely for your scenario. Can you check it out (code is there for download) and let me know if this might help?
http://www.coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/

Thanks for your patience,
Brent [import]uid: 200026 topic_id: 34591 reply_id: 140016[/import]

Hi John,
I researched your issue a bit more. The core engineers are evaluating the “order” in which some of these object interactions occur, and how it can be fixed to be more logical and user-friendly. So the issue is known, but I don’t yet know the end solution.

In the meantime, my suggestion of scaling/shifting around a “center point” using display groups was confirmed as a good and logical way to go, if you can get the shift and offset math working properly.

Atop that, I just posted a comprehensive guest tutorial about pinch-zoom-rotate. This is from the same author (Matt Webster) as the previous code share demo that (I think) you sampled, but this one is far more comprehensive. I didn’t write it, but I’ve tested it and it might work nicely for your scenario. Can you check it out (code is there for download) and let me know if this might help?
http://www.coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/

Thanks for your patience,
Brent [import]uid: 200026 topic_id: 34591 reply_id: 140016[/import]

Any update to this? Were any changes ever made regarding xReference/yReference and scaling display objects or groups?

Hi @jmaher,

I asked about this, and it seems that some changes or fixes will be addressed when the next graphics engine rolls out. So, at this time, there are no updates, but we’re aware of the issue and haven’t forgotten about it. Sorry for the inconvenience.

Best regards,

Brent

Any update to this? Were any changes ever made regarding xReference/yReference and scaling display objects or groups?

Hi @jmaher,

I asked about this, and it seems that some changes or fixes will be addressed when the next graphics engine rolls out. So, at this time, there are no updates, but we’re aware of the issue and haven’t forgotten about it. Sorry for the inconvenience.

Best regards,

Brent