You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2018/10/30 12:59:08 UTC
[29/52] [abbrv] wicket git commit: WICKET-5552 allow prevention of
drags
WICKET-5552 allow prevention of drags
used by ModalWindow to prevent dragging on window content
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ace845c4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ace845c4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ace845c4
Branch: refs/heads/WICKET-6563
Commit: ace845c412d6ea3117c6f366d9bd91b06c6270da
Parents: 6ee5313
Author: Sven Meier <sv...@apache.org>
Authored: Mon Oct 15 23:15:06 2018 +0200
Committer: Sven Meier <sv...@apache.org>
Committed: Mon Oct 15 23:31:07 2018 +0200
----------------------------------------------------------------------
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 25 +++++++++++++-------
.../ajax/markup/html/modal/res/modal.js | 11 +++++++--
2 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/ace845c4/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 5f64c0b..2f0561f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2279,13 +2279,18 @@
Drag: {
/**
- * Initializes the dragging on the specified element.
- * Element's onmousedown will be replaced by generated handler.
- *
- * @param {Element} element - element clicking on which the drag should begin
- * @param {Function} onDragBegin - handler called at the begin on dragging - passed element as first parameter
- * @param {Function} onDragEnd - handler called at the end of dragging - passed element as first parameter
- * @param {Function} onDrag - handler called during dragging - passed element and mouse deltas
+ * Initializes dragging on the specified element.
+ *
+ * @param element {Element}
+ * element clicking on which
+ * the drag should begin
+ * @param onDragBegin {Function}
+ * called at the begin of dragging - passed element and event as parameters,
+ * may return false to prevent the start
+ * @param onDragEnd {Function}
+ * handler called at the end of dragging - passed element as parameter
+ * @param onDrag {Function}
+ * handler called during dragging - passed element and mouse deltas as parameters
*/
init: function(element, onDragBegin, onDragEnd, onDrag) {
@@ -2315,14 +2320,16 @@
var element = this;
+ if (element.wicketOnDragBegin(element, e) === false) {
+ return;
+ }
+
Wicket.Event.stop(e);
if (e.preventDefault) {
e.preventDefault();
}
- element.wicketOnDragBegin(element);
-
element.lastMouseX = e.clientX;
element.lastMouseY = e.clientY;
http://git-wip-us.apache.org/repos/asf/wicket/blob/ace845c4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index b00ceec..6bcebf2 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -901,11 +901,18 @@
/**
* Called when dragging has started.
*/
- onBegin: function(object) {
+ onBegin: function(element, event) {
+ // ignore anything inside the content
+ if (jQuery(event.target).closest('.w_content').size()) {
+ return false;
+ }
+
if (this.isIframe() && (Wicket.Browser.isGecko() || Wicket.Browser.isIELessThan11() || Wicket.Browser.isSafari())) {
this.revertList = [];
Wicket.Iframe.documentFix(document, this.revertList);
}
+
+ return true;
},
/**
@@ -1183,7 +1190,7 @@
"<div class=\"w_left\" id='"+idLeft+"'>"+
"<div class=\"w_right_1\">"+
"<div class=\"w_right\" id='"+idRight+"'>"+
- "<div class=\"w_content_1\" onmousedown=\"Wicket.Event.stop(event);\">"+
+ "<div class=\"w_content_1\">"+
"<div class=\"w_caption\" id=\""+idCaption+"\">"+
"<a class=\"w_close\" style=\"z-index:1\" href=\"#\"></a>"+
"<h3 id=\""+idCaptionText+"\" class=\"w_captionText\"></h3>"+