Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129344

When panning the map slowly (using DragHandler's onTranslationChanged signal with delta as qreal), the Map.pan(int) function fails to handle the movement properly.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.7.2
    • Location
    • None
    • Qt6.7.2 Clang arm64-v8a
    • Android

    Description

       import QtQuick
       import QtLocation
       import QtPositioning Window {
           ...
           Plugin {
               id: mapPlugin
               name: "osm"
           }     Map {
               id: map
               anchors.fill: parent
               plugin: mapPlugin
               center: QtPositioning.coordinate(59.91, 10.75) // Oslo
               zoomLevel: 14
               property geoCoordinate startCentroid         PinchHandler {
                   id: pinch
                   target: null
                   onActiveChanged: if (active) {
                       map.startCentroid = map.toCoordinate(pinch.centroid.position, false)
                   }
                   onScaleChanged: (delta) => {
                       map.zoomLevel += Math.log2(delta)
                       map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
                   }
                   onRotationChanged: (delta) => {
                       map.bearing -= delta
                       map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
                   }
                   grabPermissions: PointerHandler.TakeOverForbidden
               }
               WheelHandler {
                   id: wheel
                   // workaround for QTBUG-87646 / QTBUG-112394 / QTBUG-112432:
                   // Magic Mouse pretends to be a trackpad but doesn't work with PinchHandler
                   // and we don't yet distinguish mice and trackpads on Wayland either
                   acceptedDevices: Qt.platform.pluginName === "cocoa" || Qt.platform.pluginName === "wayland"
                                    ? PointerDevice.Mouse | PointerDevice.TouchPad
                                    : PointerDevice.Mouse
                   rotationScale: 1/120
                   property: "zoomLevel"
               }
               DragHandler {
                   id: drag
                   target: null
                   onTranslationChanged: (delta) => map.pan(-delta.x, -delta.y)
               }
               Shortcut {
                   enabled: map.zoomLevel < map.maximumZoomLevel
                   sequence: StandardKey.ZoomIn
                   onActivated: map.zoomLevel = Math.round(map.zoomLevel + 1)
               }
               Shortcut {
                   enabled: map.zoomLevel > map.minimumZoomLevel
                   sequence: StandardKey.ZoomOut
                   onActivated: map.zoomLevel = Math.round(map.zoomLevel - 1)
               }
           }
       }
       

      I really don't want to complain, but this example code provided by you has delta as a qreal type, while pan expects int. As a result, when dragging slowly, it's impossible to handle the movement properly.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paangele Paolo Angelelli
            lixiao 李啸 李
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes