|
|
@@ -1,5 +1,6 @@
|
|
|
import * as moment from 'moment'
|
|
|
import { applyStyle, computeHeightAndMargins } from './util/dom'
|
|
|
+import { preventDefault } from './util/dom-event'
|
|
|
|
|
|
|
|
|
/* FullCalendar-specific DOM Utilities
|
|
|
@@ -159,47 +160,10 @@ export function subtractInnerElHeight(outerEl: HTMLElement, innerEl: HTMLElement
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* Mouse / Touch Utilities
|
|
|
+/* Selection
|
|
|
----------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
-// Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
|
|
|
-export function isPrimaryMouseButton(ev: MouseEvent) {
|
|
|
- return ev.button === 0 && !ev.ctrlKey
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-export function getEvX(ev: UIEvent) {
|
|
|
- let touches = (ev as TouchEvent).touches
|
|
|
-
|
|
|
- // on mobile FF, pageX for touch events is present, but incorrect,
|
|
|
- // so, look at touch coordinates first.
|
|
|
- if (touches && touches.length) {
|
|
|
- return touches[0].pageX
|
|
|
- }
|
|
|
-
|
|
|
- return (ev as MouseEvent).pageX
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-export function getEvY(ev) {
|
|
|
- let touches = (ev as TouchEvent).touches
|
|
|
-
|
|
|
- // on mobile FF, pageX for touch events is present, but incorrect,
|
|
|
- // so, look at touch coordinates first.
|
|
|
- if (touches && touches.length) {
|
|
|
- return touches[0].pageY
|
|
|
- }
|
|
|
-
|
|
|
- return (ev as MouseEvent).pageY
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-export function getEvIsTouch(ev) {
|
|
|
- return /^touch/.test(ev.type)
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
export function preventSelection(el: HTMLElement) {
|
|
|
el.classList.add('fc-unselectable')
|
|
|
el.addEventListener('selectstart', preventDefault)
|
|
|
@@ -212,11 +176,6 @@ export function allowSelection(el: HTMLElement) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// Stops a mouse/touch event from doing it's native browser action
|
|
|
-export function preventDefault(ev) {
|
|
|
- ev.preventDefault()
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
/* General Geometry Utils
|
|
|
----------------------------------------------------------------------------------------------------------------------*/
|