Announcement

Collapse
No announcement yet.

How to keep dragging widgets completely in viewport?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to keep dragging widgets completely in viewport?

    Hi there, i ran into some, at least cosmetic, problems while polishing up my drag and drop widget system.

    Since i use only a border on top of my widget to detect the drag, the other (lower) part of the widget can be dragged off the screen. This leads to sometimes dropping the widget off the screen.
    To avoid it i´d like to keep the whole dragging widget in the viewport. But how can i set this up to detect whenever the dragging widget leaves the viewport?


    All solutions i found during my search are referring to an already dropped widget but not the dragging (just visual) one.
    Any ideas how to achieve this?

    #2
    I created a custom mouse cursor widget in the size of the dragged widget last night but it does not solve my problem. I can set the offset of the dragging widget but i can not stop the widget from leaving the screen on at least two sides (depending on the offset).

    I put this on answerhub too. Really hope to find someone, pointing me the right direction

    Comment


      #3
      still made no progress at this. Seems like the actual clickzone of a cursor widget can not be larger than 1px. That 1px is detected by viewport bounds but the other part of the mouse cursor is ignored and can still leave the viewport.

      How do you guys manage to keep your dragable widgets in the viewport?

      Comment


        #4
        Managed to keep the dragging widget in viewport by detecting the actual screen position and calculating a new offset. The script is located in the drag operation blueprint and fired on event dragged.
        This actual works but the player can see the widget "jumping" to its offset. This doesn´t seem to be liquid enough for a final game. So i removed it.
        Still looking for a better solution..

        For now i decided that this is a feature and not a bug anymore ^^ the player can now close the widgets by dragging them out of screen.
        Really sad, that nobody did reply on this. Can´t believe i am the only one wanting to achieve this (?).

        Comment

        Working...
        X