onPointerMove method
Implementation
@override
void onPointerMove(int pointerId, Offset offset, Map<int, Offset> pointers) {
//_log.info("move ${pointers.length}, active $_moveActive, timer: ${activeTimer()}, swipetimer: $_swipeTimer, offset $_swipeOffset");
if (!activeTimer() && !_moveActive) {
return;
}
super.onPointerMove(pointerId, offset, pointers);
cancelTimer();
_moveActive = true;
velocityCalculator.addEvent(offset);
double diffX = (offset.dx - startOffset!.dx) * MapsforgeSettingsMgr().getDeviceScaleFactor();
double diffY = (offset.dy - startOffset!.dy) * MapsforgeSettingsMgr().getDeviceScaleFactor();
if (startPosition!.rotation != 0) {
double hyp = sqrt(diffX * diffX + diffY * diffY);
double rad = atan2(diffY, diffX);
double rot = startPosition!.rotationRadian;
diffX = cos(-rot + rad) * hyp;
diffY = sin(-rot + rad) * hyp;
}
if (_nextManualMoveEvent == 0 || _nextManualMoveEvent < DateTime.now().millisecondsSinceEpoch) {
_nextManualMoveEvent = DateTime.now().millisecondsSinceEpoch + 1000;
mapModel.manualMove(Object());
}
// double x = max(startPosition!.getCenter().x - diffX, 0);
// double y = max(startPosition!.getCenter().y - diffY, 0);
mapModel.moveCenter(_lastOffset.dx - diffX, _lastOffset.dy - diffY);
_lastOffset = MappointRelative(diffX, diffY);
//_log.info(" center: $x/$y $diffX/$diffY");
}