Page 1 of 1

CFrame::setZoom() on iOS

Posted: Mon May 29, 2017 3:20 pm
by ray
Hi,

calling CFrame::setZoom() on iOS yields the correct scaling of my frame's content. However, the touch event handling always seems to respect the original coordinate system, i.e. controls still react to their original bounding boxes present before the setZoom() call.

I haven't analyzed the problem in depth, but everything works as expected on Mac OS and Windows targets, so I suspect the bug is located in CFrame::platformOnTouchEvent() or the calling code in uiviewframe.mm. And in fact, applying the inverse transform to the touch location in updateTouchEvent: in VSTGUI_UIView seems to fix the described issue:

Code: Select all


uiviewframe.mm

- (void)updateTouchEvent:(NSSet*)touches
{
auto ctm = ((CFrame*) uiViewFrame->getFrame())->getTransform().inverse()
...
iTouch->second.location = CPointFromCGPoint ([touch locationInView:self]);
ctm.transform(iTouch->second.location);		

...

t.location = CPointFromCGPoint ([touch locationInView:self]);
ctm.transform(t.location);
...
But of course, this should be considered anything but a clean fix.

The goal is to scale an existing desktop implementation of my editor to fit a given iOS device's display using CFrame::setZoom(). Any hints on what would be an alternative or the goto approach?

Thanks!

Re: CFrame::setZoom() on iOS

Posted: Tue May 30, 2017 7:50 am
by Arne Scheffler
Hi Ray,
setZoom was not yet tested on iOS and I think the correct approach would be to apply the transform in CFrame::platformOnTouchEvent and not in uiviewframe.mm.

Cheers
Arne

Re: CFrame::setZoom() on iOS

Posted: Tue May 30, 2017 7:44 pm
by ray
Thanks for clearing that up, Arne, that's what I expected. Patching CFrame / CViewContainer in order to adjust the event location is a little more involved. I'll try to make it into a pull-request as I have a couple of other bug fix suggestions.

Best,
Ray