OHIF-15 Fixed cine dialog positioning + dragging whole dialog even when clicking on a button.
This commit is contained in:
1 parent
ca28f5dbce
commit
5aaa5b934d
6 files changed
+142
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// Allow attaching to jQuery selectors
|
||||
$.fn.draggable = function() {
|
||||
makeDraggable(this);
|
||||
$.fn.draggable = function(options) {
|
||||
makeDraggable(this, options);
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -11,10 +11,17 @@ $.fn.draggable = function() {
|
||||
*
|
||||
* @param element
|
||||
*/
|
||||
makeDraggable = function(element) {
|
||||
makeDraggable = function(element, options) {
|
||||
var container = $(window);
|
||||
var diffX,
|
||||
diffY;
|
||||
diffY,
|
||||
wasNotDragged = true;
|
||||
|
||||
options = options || {};
|
||||
options.defaultElementCursor = options.defaultElementCursor || 'default';
|
||||
|
||||
// initialize dragged flag
|
||||
element.data('wasDragged', false);
|
||||
|
||||
function getCursorCoords(e) {
|
||||
var cursor = {
|
||||
@@ -62,11 +69,18 @@ makeDraggable = function(element) {
|
||||
|
||||
$(document).on('touchmove', moveHandler);
|
||||
$(document).on('touchend', stopMoving);
|
||||
|
||||
// let outside world know that the element in question has been dragged
|
||||
if (wasNotDragged) {
|
||||
element.data('wasDragged', true);
|
||||
wasNotDragged = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function stopMoving() {
|
||||
container.css('cursor', 'default');
|
||||
element.css('cursor', 'default');
|
||||
element.css('cursor', options.defaultElementCursor);
|
||||
|
||||
$(document).off('mousemove', moveHandler);
|
||||
$(document).off('touchmove', moveHandler);
|
||||
|
||||
Reference in new issue
Block a user