No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [Solved] How to change the default "grabbing" cursor during TouchPan?

    Help
    1
    2
    234
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      ddenev last edited by ddenev

      Hi,

      I’m trying to utilize the TouchPan directive in order to enable drag-n-drop for a div element.

      That div plays the role of a “drag handle” for a QDrawer and I need the cursor to be “col-resize” during the dragging. The default cursor while panning is “grabbing” and I don’t know how to change it.

      I tried changing the cursor in the first handler call:

      onTouchPan (event) {
        if (event.isFirst) {
          document.documentElement.style.cursor = 'col-resize'
        }
        if (event.isFinal) {
          document.documentElement.style.cursor = ''
        }
      }
      

      but this did not work - in the TouchPan.js code, the “grabbing” cursor is set after the call to my handler.

      I also don’t want to set the cursor outside of “isFirst” check because that would effectively set the style on every event, which is a lot.

      Any ideas?

      D 1 Reply Last reply Reply Quote 0
      • D
        ddenev @ddenev last edited by

        Here is the solution (with the help from @eduardodgarciac):

        onTouchPan (event) {
          if (event.isFirst) {
            this.$nextTick(() => {
              document.documentElement.style.cursor = 'col-resize'
            })
          }
          if (event.isFinal) {
            // no need to revert the cursor here since TouchPad does this anyway
          }
        }
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post