+ Reply to Thread
Results 1 to 4 of 4

Thread: LibDraggable: Because it was easy

  1. #1
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default LibDraggable: Because it was easy

    http://www.riftui.com/downloads/info...Draggable.html

    Makes windows draggable. (Developer utility.)

    Wrote this because I was about to copy and paste the code from one addon to another, decided that I would do that, but I would only ever do it once.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  2. #2
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    Eh, not as easy as I'd like -- it seems to occasionally "stick" in dragging mode because it doesn't get a mouseup. I suppose I should look for mouseout, too, or something?
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  3. #3
    Rift Disciple
    Join Date
    Jan 2011
    Posts
    147

    Default

    Code:
    local function AddDragEventsToBorder(window)
      local border = window:GetBorder()
      function border.Event:LeftDown()
        self.leftDown = true
        local mouse = Inspect.Mouse()
        self.originalXDiff = mouse.x - self:GetLeft()
        self.originalYDiff = mouse.y - self:GetTop()
        local left, top, right, bottom = window:GetBounds()
        window:ClearAll()
        window:SetPoint("TOPLEFT", UIParent, "TOPLEFT", left, top)
        window:SetWidth(right-left)
        window:SetHeight(bottom-top)
      end
      function border.Event:LeftUp()
        self.leftDown = false
      end
      function border.Event:LeftUpoutside()
        self.leftDown = false
      end
      function border.Event:MouseMove(x, y)
        if not self.leftDown then
          return
        end
        window:SetPoint("TOPLEFT", UIParent, "TOPLEFT", x - self.originalXDiff, y - self.originalYDiff)
      end
    end
    That's for a RiftWindow. Adjust as necessary for other frames.
    Last edited by dOxxx; 01-07-2012 at 08:25 PM.

  4. #4
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    LeftUpoutside() is what I was missing, I think.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts