@Override protected void onTouchDown( Touch t ) { if (t != touch && another == null) { if (!touch.down) { touch = t; onTouchDown( t ); return; } pinching = true; another = t; startSpan = PointF.distance( touch.current, another.current ); startZoom = camera.zoom; dragging = false; } }
@Override protected void onDrag( NoosaInputProcessor.Touch t ) { if (dragging) { doScroll(t.current); } else if (PointF.distance( t.current, t.start ) > dragThreshold) { dragging = true; lastPos.set( t.current ); thumb.am = 1; } }
@Override protected void onTouchDown( Touch t ) { if (t != touch && another == null) { if (!touch.down) { touch = t; onTouchDown( t ); return; } pinching = true; another = t; startSpan = PointF.distance( touch.current, another.current ); startZoom = camera.zoom; dragging = false; } else if (t != touch) { reset(); } }
@Override protected void onTouchDown( NoosaInputProcessor.Touch t ) { if (t != touch && another == null) { if (!touch.down) { touch = t; onTouchDown( t ); return; } pinching = true; another = t; startSpan = PointF.distance( touch.current, another.current ); startZoom = camera.zoom; dragging = false; } else if (t != touch) { reset(); } }
@Override protected void onDrag( Touch t ) { camera.target = null; if (pinching) { float curSpan = PointF.distance( touch.current, another.current ); float zoom = (startZoom * curSpan / startSpan); camera.zoom( GameMath.gate( PixelScene.minZoom, zoom - (zoom % 0.1f), PixelScene.maxZoom ) ); } else { if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) { dragging = true; lastPos.set( t.current ); } else if (dragging) { camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) ); lastPos.set( t.current ); } } }
@Override protected void onDrag( Touch t ) { camera.target = null; if (pinching) { float curSpan = PointF.distance( touch.current, another.current ); camera.zoom( GameMath.gate( PixelScene.minZoom, startZoom * curSpan / startSpan, PixelScene.maxZoom ) ); } else { if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) { dragging = true; lastPos.set( t.current ); } else if (dragging) { camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) ); lastPos.set( t.current ); } } }
@Override protected void onDrag( NoosaInputProcessor.Touch t ) { camera.target = null; if (pinching) { float curSpan = PointF.distance( touch.current, another.current ); float zoom = (startZoom * curSpan / startSpan); camera.zoom( GameMath.gate( PixelScene.minZoom, zoom - (zoom % 0.1f), PixelScene.maxZoom ) ); } else { if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) { dragging = true; lastPos.set( t.current ); } else if (dragging) { camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) ); lastPos.set( t.current ); } } }
@Override protected void onDrag( Touch t ) { if (dragging) { Camera c = content.camera; c.scroll.offset( PointF.diff( lastPos, t.current ).invScale( c.zoom ) ); if (c.scroll.x + width > content.width()) { c.scroll.x = content.width() - width; } if (c.scroll.x < 0) { c.scroll.x = 0; } if (c.scroll.y + height > content.height()) { c.scroll.y = content.height() - height; } if (c.scroll.y < 0) { c.scroll.y = 0; } indicator.y = y + height * c.scroll.y / content.height(); lastPos.set( t.current ); } else if (PointF.distance( t.current, t.start ) > dragThreshold) { indicator.am = INDICATOR_SOLID; dragging = true; lastPos.set( t.current ); } } }
@Override protected void onDrag( Touch t ) { if (dragging) { Camera c = content.camera; c.scroll.offset( PointF.diff( lastPos, t.current ).invScale( c.zoom ) ); if (c.scroll.x + width > content.width()) { c.scroll.x = content.width() - width; } if (c.scroll.x < 0) { c.scroll.x = 0; } if (c.scroll.y + height > content.height()) { c.scroll.y = content.height() - height; } if (c.scroll.y < 0) { c.scroll.y = 0; } thumb.y = y + height * c.scroll.y / content.height(); lastPos.set( t.current ); } else if (PointF.distance( t.current, t.start ) > dragThreshold) { dragging = true; lastPos.set( t.current ); thumb.am = 1; } } }