Opened 11 years ago

Closed 11 years ago

#6563 closed enhancement (fixed)

Dialog: enhancement - allow ability to not drag

Reported by: dante Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit Version: 1.1.0
Keywords: Cc:
Blocked By: Blocking:

Description

A seemingly common request, and a workaround is available, but pretty ugly (the lazy creation of the moveable makes it difficult) ... a dijit fix would be trivial, but would add a new public parameter. I would suggest 'dragable' as a boolean, true by default, and a one-line addition to Dialog.js:

if(this.titleNode && this.dragable){ /* make mover */ 

to prevent the creation of the mover.

This comes up as a user request in my opinion to constitute the functionality, and it is extremely low-risk / api-break free.

will attach trivial patch.

Attachments (3)

dialog.patch (5.0 KB) - added by dante 11 years ago.
updated, missed a g
dialog.2.patch (8.0 KB) - added by dante 11 years ago.
updated patch also fixes 6502
dialog-final.patch (10.7 KB) - added by dante 11 years ago.
ughain.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by bill

Summary: [dijit] Dialog enhancement - allow ability to not dragDialog: enhancement - allow ability to not drag

This would involve the following changes:

  • new draggable parameter (btw: google tells me that it's spelled "draggable" not "dragable" so let's do that)
  • set or not set CSS class so movable cursor appears when hovering over title
  • see #6502. iff draggable==false, then resizing the window should re-center the dialog. Or alternately update #6502 so that the dialog re-centers on window resize unless it has been moved.

Changed 11 years ago by dante

Attachment: dialog.patch added

updated, missed a g

comment:2 Changed 11 years ago by dante

items 1 and 2 are fixed in the newest patch. re: #6502 I still maintain the logic needed to implement is unrelated to this change, or is at best independent.

I can attempt to implement #6502 displaying this separation of logic - though that is targeted 1.3 at this time.

Changed 11 years ago by dante

Attachment: dialog.2.patch added

updated patch also fixes 6502

comment:3 Changed 11 years ago by dante

still needs CSS to accomodate draggable=false on the titlebar, but that's really simple now it has dijitDialogFixed on this.domNode

comment:4 Changed 11 years ago by bill

Ok, it's looking pretty good, note that this patch also fixes #6502... there are a few issues:

  • when screen is resized dialog doesn't recenter, even if user *hasn't* moved it
  • when user moves and dialog, closes it, and then reopens it, it should be centered, right? instead it's at the position the user moved it to the previous time
  • "&& p.t && p.l" checks are unneeded and problematic in case that p.t and/or p.l is 0, which is a valid (and non-special) value
  • spelling typo on "// dragable: Boolean"
  • comment for layout function is wrong: need to explain behavior on resize and on scroll for when user has/has not moved the dialog. Actually should write that in the description of the widget too.

comment:5 in reply to:  4 Changed 11 years ago by dante

Replying to bill:

The first point about recenter: Dialog doesn't currently do that. only the underlay listens to window.resize. moving _resizeHandler in underlay to dialog _modalConnects would solve the re-centering on window resize issue.

The second item/point, re: move->close->reopen ... it's debatable, but trivial to implement what you want. in hide:function()

if(this._relativePosition){ delete this._relativePosition }

though playing with it, i sort of like it showing where i last put it. maybe a recenter="" boolean? anyway both of those points are trivial fixes.

the other two are documentation, so I suppose we need to determine the behavior it should have.

i will address the p && p.t checks. I think p.t !== undefined should cover it.

Changed 11 years ago by dante

Attachment: dialog-final.patch added

ughain.

comment:6 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

(In [13355]) Enhance Dialog so:

  • if the user has moved the dialog then don't recenter it on browser window resize or scroll. Rather, treat it as though it's position:fixed. (fixes #6502)
  • add draggable initialization parameter, to (optionally) prevent dialogs from being dragged (fixes #6563)

Patch from Peter Higgins.

Note: See TracTickets for help on using tickets.