2
0
Эх сурвалжийг харах

kill native-browser-selection on any drag

Adam Shaw 9 жил өмнө
parent
commit
d5a7c81e43

+ 4 - 0
src/common/DragListener.js

@@ -61,6 +61,8 @@ var DragListener = FC.DragListener = Class.extend(ListenerMixin, {
 			this.minDistance = firstDefined(extraOptions.distance, this.options.distance, 0);
 			this.subjectEl = this.options.subjectEl;
 
+			preventSelection($('body'));
+
 			this.isInteracting = true;
 			this.isTouch = isTouch;
 			this.isDelayEnded = false;
@@ -101,6 +103,8 @@ var DragListener = FC.DragListener = Class.extend(ListenerMixin, {
 
 			this.isInteracting = false;
 			this.handleInteractionEnd(ev, isCancelled);
+
+			allowSelection($('body'));
 		}
 	},
 

+ 0 - 3
src/common/Popover.js

@@ -65,9 +65,6 @@ var Popover = Class.extend(ListenerMixin, {
 			.append(options.content)
 			.appendTo(options.parentEl);
 
-		// prevent a touch-related native selection
-		preventSelection(this.el);
-
 		// when a click happens on anything inside with a 'fc-close' className, hide the popover
 		this.el.on('click', '.fc-close', function() {
 			_this.hide();

+ 6 - 0
src/util.js

@@ -352,6 +352,12 @@ function preventSelection(el) {
 }
 
 
+function allowSelection(el) {
+	el.removeClass('fc-unselectable')
+		.off('selectstart', preventDefault);
+}
+
+
 // Stops a mouse/touch event from doing it's native browser action
 function preventDefault(ev) {
 	ev.preventDefault();