|
|
@@ -156,7 +156,7 @@ function subtractInnerElHeight(outerEl, innerEl) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* General DOM Utilities
|
|
|
+/* Element Geom Utilities
|
|
|
----------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
FC.getOuterRect = getOuterRect;
|
|
|
@@ -293,13 +293,57 @@ function getCssFloat(el, prop) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+/* Mouse / Touch Utilities
|
|
|
+----------------------------------------------------------------------------------------------------------------------*/
|
|
|
+
|
|
|
+
|
|
|
// Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
|
|
|
function isPrimaryMouseButton(ev) {
|
|
|
return ev.which == 1 && !ev.ctrlKey;
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* Geometry
|
|
|
+function isSingleTouch(ev) {
|
|
|
+ var touches = ev.originalEvent.touches;
|
|
|
+ return touches && touches.length == 1;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function getEvX(ev) {
|
|
|
+ if (ev.pageX !== undefined) {
|
|
|
+ return ev.pageX;
|
|
|
+ }
|
|
|
+ var touches = ev.originalEvent.touches;
|
|
|
+ if (touches && touches.length == 1) {
|
|
|
+ return touches[0].pageX;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function getEvY(ev) {
|
|
|
+ if (ev.pageY !== undefined) {
|
|
|
+ return ev.pageY;
|
|
|
+ }
|
|
|
+ var touches = ev.originalEvent.touches;
|
|
|
+ if (touches && touches.length == 1) {
|
|
|
+ return touches[0].pageY;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function preventSelection(el) {
|
|
|
+ el.addClass('fc-unselectable')
|
|
|
+ .on('selectstart', preventDefault);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// Stops a mouse/touch event from doing it's native browser action
|
|
|
+function preventDefault(ev) {
|
|
|
+ ev.preventDefault();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/* General Geometry Utils
|
|
|
----------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
FC.intersectRects = intersectRects;
|