Rasalexman/YCanvasStarling2.x

Problems with scrolling zooming the map in device

pawelstan opened this issue · 13 comments

Hi!

I have a problem with touch-moving the map. Using one finger to move the map it moves 2x faster than my finger moves. Also, when zooming with 2 fingers, the zoom center is not between those 2 fingers, its somewhere bottom right.

Another thing is the hitTestComponent in YCanvasMap.as. This is also "moved".

Looks like the same problem for those 3 issues. like the touch points are scaled and/or moved differently than the screen.

Any ideas?

Cheers,
P.

I need to check this soon

The only idea which I have now is that it doesnt support scaleFactor calculated by ScreenDensityScaleFactorManager

it's not using default scale factor

what if I change scaleFactor in starlings current stage. will It work with it? or its always using value = 1?

if u will see utils.Dimansion there are function init()

public static function init( display:Stage ) : void {
			screenWidth = display.fullScreenWidth;
			screenHeight = display.fullScreenHeight;
			
			// ONLY FOR SCALE MARKER IN RIGHT PRPORTIONS, CAUSE I MADE IT (marker image) FOR MY PHONE SCREEN RESOLUTION
			proportion = NumberUtilities.round(screenHeight / 1920, 0.1);
		}

but i use it only for marker on map

also i use sk.yoz.ycanvas.map.display.MapDisplay

 /**
        * Width of the component is handled custom for clipping purposes.
        */
        override public function get width():Number
        {
            return Dimansion.screenWidth;
        }
        
        /**
         * Width of the component is handled custom for clipping purposes.
         */
        override public function get height():Number
        {
            return Dimansion.screenHeight;
        }

will check those places. thanks!

changing those values didnt change the scope of the issue.

about touch zoom event u can see sk.yoz.touch.TwoFingerTouch and
sk.yoz.touch.TransitionMultitouch
and
com.views.maps.CMapHelperMain construction function line

//trace("Capabilities.manufacturer",Capabilities.manufacturer);
			transformationManager = flash.system.Capabilities.manufacturer.indexOf("Android") == -1 ? new MouseTransformationManager(map, limit) : new TouchTransformationManager(map, limit);

this manages is control mouse or touch events too

as u can see it's require limit variable that is defined later

const limit:Limit = new Limit;
			limit.minScale = 1;
			limit.maxScale = 1 / 65536;
			limit.minCenterX = 0;
			limit.maxCenterX = GeoUtils.lon2x(180);
			limit.minCenterY = GeoUtils.lat2y(85);
			limit.maxCenterY = GeoUtils.lat2y(-85);

u can play with some setting to configure map center for zooming, may be u need to connect it with stage bounds.

hmmm, will check that

of course there some saving of my custom values

const transformation:Transformation = new Transformation;
transformation.centerX and transformation.centerY

It was:

sk\yoz\touch\TwoFingerTouch.as

public function getPoint(event:TouchEvent):Point {
return new Point(event.stageX / Starling.current.contentScaleFactor, event.stageY / Starling.current.contentScaleFactor)
}

so the idea of checking the transformationManager was correct. Thanks!