Procházet zdrojové kódy

strip out interactions

Adam Shaw před 7 roky
rodič
revize
dc5ef54700

+ 0 - 3
src/Calendar.ts

@@ -12,7 +12,6 @@ import OptionsManager from './OptionsManager'
 import ViewSpecManager from './ViewSpecManager'
 import View from './View'
 import Theme from './theme/Theme'
-import Constraints from './Constraints'
 import UnzonedRange from './models/UnzonedRange'
 import BusinessHourGenerator from './models/BusinessHourGenerator'
 import { getThemeSystemClass } from './theme/ThemeRegistry'
@@ -49,7 +48,6 @@ export default class Calendar {
   viewsByType: { [viewName: string]: View } // holds all instantiated view instances, current or not
   currentDate: DateMarker // private (public API should use getDate instead)
   theme: Theme
-  constraints: Constraints
   optionsManager: OptionsManager
   viewSpecManager: ViewSpecManager
   businessHourGenerator: BusinessHourGenerator
@@ -88,7 +86,6 @@ export default class Calendar {
     this.viewSpecManager = new ViewSpecManager(this.optionsManager, this)
     this.initDateEnv() // needs to happen after options hash initialized
     this.initCurrentDate()
-    this.constraints = new Constraints(this)
 
     this.constructed()
     this.hydrate()

+ 0 - 373
src/Constraints.ts

@@ -1,373 +0,0 @@
-import UnzonedRange from './models/UnzonedRange'
-import ComponentFootprint from './models/ComponentFootprint'
-import EventFootprint from './models/event/EventFootprint'
-import EventDefParser from './models/event/EventDefParser'
-import EventSource from './models/event-source/EventSource'
-import {
-  eventInstanceToEventRange,
-  eventFootprintToComponentFootprint,
-  eventRangeToEventFootprint
-} from './models/event/util'
-
-
-export default class Constraints {
-
-  eventManager: any
-  _calendar: any // discourage
-
-
-  constructor(eventManager, _calendar) {
-    this.eventManager = eventManager
-    this._calendar = _calendar
-  }
-
-
-  opt(name) {
-    return this._calendar.opt(name)
-  }
-
-
-  /*
-  determines if eventInstanceGroup is allowed,
-  in relation to other EVENTS and business hours.
-  */
-  isEventInstanceGroupAllowed(eventInstanceGroup) {
-    let eventDef = eventInstanceGroup.getEventDef()
-    let eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges())
-    let i
-
-    let peerEventInstances = this.getPeerEventInstances(eventDef)
-    let peerEventRanges = peerEventInstances.map(eventInstanceToEventRange)
-    let peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges)
-
-    let constraintVal = eventDef.getConstraint()
-    let overlapVal = eventDef.getOverlap()
-
-    let eventAllowFunc = this.opt('eventAllow')
-
-    for (i = 0; i < eventFootprints.length; i++) {
-      if (
-        !this.isFootprintAllowed(
-          eventFootprints[i].componentFootprint,
-          peerEventFootprints,
-          constraintVal,
-          overlapVal,
-          eventFootprints[i].eventInstance
-        )
-      ) {
-        return false
-      }
-    }
-
-    if (eventAllowFunc) {
-      for (i = 0; i < eventFootprints.length; i++) {
-        if (
-          eventAllowFunc(
-            eventFootprints[i].componentFootprint.toLegacy(this._calendar),
-            eventFootprints[i].getEventLegacy(this._calendar)
-          ) === false
-        ) {
-          return false
-        }
-      }
-    }
-
-    return true
-  }
-
-
-  getPeerEventInstances(eventDef) {
-    return this.eventManager.getEventInstancesWithoutId(eventDef.id)
-  }
-
-
-  isSelectionFootprintAllowed(componentFootprint) {
-    let peerEventInstances = this.eventManager.getEventInstances()
-    let peerEventRanges = peerEventInstances.map(eventInstanceToEventRange)
-    let peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges)
-
-    let selectAllowFunc
-
-    if (
-      this.isFootprintAllowed(
-        componentFootprint,
-        peerEventFootprints,
-        this.opt('selectConstraint'),
-        this.opt('selectOverlap')
-      )
-    ) {
-      selectAllowFunc = this.opt('selectAllow')
-
-      if (selectAllowFunc) {
-        return selectAllowFunc(componentFootprint.toLegacy(this._calendar)) !== false
-      } else {
-        return true
-      }
-    }
-
-    return false
-  }
-
-
-  isFootprintAllowed(
-    componentFootprint,
-    peerEventFootprints,
-    constraintVal,
-    overlapVal,
-    subjectEventInstance? // optional
-  ) {
-    let constraintFootprints // ComponentFootprint[]
-    let overlapEventFootprints // EventFootprint[]
-
-    if (constraintVal != null) {
-      constraintFootprints = this.constraintValToFootprints(constraintVal, componentFootprint.isAllDay)
-
-      if (!this.isFootprintWithinConstraints(componentFootprint, constraintFootprints)) {
-        return false
-      }
-    }
-
-    overlapEventFootprints = this.collectOverlapEventFootprints(peerEventFootprints, componentFootprint)
-
-    if (overlapVal === false) {
-      if (overlapEventFootprints.length) {
-        return false
-      }
-    } else if (typeof overlapVal === 'function') {
-      if (!isOverlapsAllowedByFunc(overlapEventFootprints, overlapVal, subjectEventInstance, this._calendar)) {
-        return false
-      }
-    }
-
-    if (subjectEventInstance) {
-      if (!isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance, this._calendar)) {
-        return false
-      }
-    }
-
-    return true
-  }
-
-
-  // Constraint
-  // ------------------------------------------------------------------------------------------------
-
-
-  isFootprintWithinConstraints(componentFootprint, constraintFootprints) {
-    let i
-
-    for (i = 0; i < constraintFootprints.length; i++) {
-      if (this.footprintContainsFootprint(constraintFootprints[i], componentFootprint)) {
-        return true
-      }
-    }
-
-    return false
-  }
-
-
-  constraintValToFootprints(constraintVal, isAllDay) {
-    let eventInstances
-
-    if (constraintVal === 'businessHours') {
-      return this.buildCurrentBusinessFootprints(isAllDay)
-    } else if (typeof constraintVal === 'object' && constraintVal) { // non-null object
-      eventInstances = this.parseEventDefToInstances(constraintVal) // handles recurring events
-
-      if (!eventInstances) { // invalid input. fallback to parsing footprint directly
-        return this.parseFootprints(constraintVal)
-      } else {
-        return this.eventInstancesToFootprints(eventInstances)
-      }
-    } else if (constraintVal != null) { // an ID
-      eventInstances = this.eventManager.getEventInstancesWithId(constraintVal)
-
-      return this.eventInstancesToFootprints(eventInstances)
-    }
-  }
-
-
-  // returns ComponentFootprint[]
-  // uses current view's range
-  buildCurrentBusinessFootprints(isAllDay) {
-    let view = this._calendar.view
-    let businessHourGenerator = view.get('businessHourGenerator')
-    let unzonedRange = view.dateProfile.activeUnzonedRange
-    let eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange)
-
-    if (eventInstanceGroup) {
-      return this.eventInstancesToFootprints(eventInstanceGroup.eventInstances)
-    } else {
-      return []
-    }
-  }
-
-
-  // conversion util
-  eventInstancesToFootprints(eventInstances) {
-    let eventRanges = eventInstances.map(eventInstanceToEventRange)
-    let eventFootprints = this.eventRangesToEventFootprints(eventRanges)
-
-    return eventFootprints.map(eventFootprintToComponentFootprint)
-  }
-
-
-  // Overlap
-  // ------------------------------------------------------------------------------------------------
-
-
-  collectOverlapEventFootprints(peerEventFootprints, targetFootprint) {
-    let overlapEventFootprints = []
-    let i
-
-    for (i = 0; i < peerEventFootprints.length; i++) {
-      if (
-        this.footprintsIntersect(
-          targetFootprint,
-          peerEventFootprints[i].componentFootprint
-        )
-      ) {
-        overlapEventFootprints.push(peerEventFootprints[i])
-      }
-    }
-
-    return overlapEventFootprints
-  }
-
-
-  // Conversion: eventDefs -> eventInstances -> eventRanges -> eventFootprints -> componentFootprints
-  // ------------------------------------------------------------------------------------------------
-  // NOTE: this might seem like repetitive code with the Grid class, however, this code is related to
-  // constraints whereas the Grid code is related to rendering. Each approach might want to convert
-  // eventRanges -> eventFootprints in a different way. Regardless, there are opportunities to make
-  // this more DRY.
-
-
-  /*
-  Returns false on invalid input.
-  */
-  parseEventDefToInstances(eventInput) {
-    let eventManager = this.eventManager
-    let eventDef = EventDefParser.parse(eventInput, new EventSource(this._calendar))
-
-    if (!eventDef) { // invalid
-      return false
-    }
-
-    return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange)
-  }
-
-
-  eventRangesToEventFootprints(eventRanges) {
-    let i
-    let eventFootprints = []
-
-    for (i = 0; i < eventRanges.length; i++) {
-      eventFootprints.push.apply( // footprints
-        eventFootprints,
-        this.eventRangeToEventFootprints(eventRanges[i])
-      )
-    }
-
-    return eventFootprints
-  }
-
-
-  eventRangeToEventFootprints(eventRange): EventFootprint[] {
-    return [ eventRangeToEventFootprint(eventRange) ]
-  }
-
-
-  /*
-  Parses footprints directly.
-  Very similar to EventDateProfile::parse :(
-  */
-  parseFootprints(rawInput) {
-    const dateEnv = this._calendar.dateEnv
-    let startMeta
-    let endMeta
-
-    if (rawInput.start) {
-      startMeta = dateEnv.createMarkerMeta(rawInput.start)
-    }
-
-    if (rawInput.end) {
-      endMeta = dateEnv.createMarkerMeta(rawInput.end)
-    }
-
-    return [
-      new ComponentFootprint(
-        new UnzonedRange(startMeta ? startMeta.marker : null, endMeta ? endMeta.marker : null),
-        (startMeta && startMeta.isTimeUnspecified) && (!endMeta || endMeta.isTimeUnspecified) // isAllDay
-      )
-    ]
-  }
-
-
-  // Footprint Utils
-  // ----------------------------------------------------------------------------------------
-
-
-  footprintContainsFootprint(outerFootprint, innerFootprint) {
-    return outerFootprint.unzonedRange.containsRange(innerFootprint.unzonedRange)
-  }
-
-
-  footprintsIntersect(footprint0, footprint1) {
-    return footprint0.unzonedRange.intersectsWith(footprint1.unzonedRange)
-  }
-
-}
-
-
-// optional subjectEventInstance
-function isOverlapsAllowedByFunc(overlapEventFootprints, overlapFunc, subjectEventInstance, calendar) {
-  let i
-
-  for (i = 0; i < overlapEventFootprints.length; i++) {
-    if (
-      !overlapFunc(
-        overlapEventFootprints[i].eventInstance.toLegacy(calendar),
-        subjectEventInstance ? subjectEventInstance.toLegacy(calendar) : null
-      )
-    ) {
-      return false
-    }
-  }
-
-  return true
-}
-
-
-function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance, calendar) {
-  let subjectLegacyInstance = subjectEventInstance.toLegacy(calendar)
-  let i
-  let overlapEventInstance
-  let overlapEventDef
-  let overlapVal
-
-  for (i = 0; i < overlapEventFootprints.length; i++) {
-    overlapEventInstance = overlapEventFootprints[i].eventInstance
-    overlapEventDef = overlapEventInstance.def
-
-    // don't need to pass in calendar, because don't want to consider global eventOverlap property,
-    // because we already considered that earlier in the process.
-    overlapVal = overlapEventDef.getOverlap()
-
-    if (overlapVal === false) {
-      return false
-    } else if (typeof overlapVal === 'function') {
-      if (
-        !overlapVal(
-          overlapEventInstance.toLegacy(calendar),
-          subjectLegacyInstance
-        )
-      ) {
-        return false
-      }
-    }
-  }
-
-  return true
-}
-

+ 3 - 151
src/View.ts

@@ -561,136 +561,6 @@ export default abstract class View extends InteractiveDateComponent {
   }
 
 
-  /* Event Drag-n-Drop
-  ------------------------------------------------------------------------------------------------------------------*/
-
-
-  reportEventDrop(eventInstance, eventMutation, el, ev) {
-    let eventManager = this.calendar.eventManager
-    let revertFunc = eventManager.mutateEventsWithId(
-      eventInstance.def.id,
-      eventMutation
-    )
-    let dateMutation = eventMutation.dateMutation
-
-    // update the EventInstance, for handlers
-    if (dateMutation) {
-      eventInstance.dateProfile = dateMutation.buildNewDateProfile(
-        eventInstance.dateProfile,
-        this.calendar
-      )
-    }
-
-    this.triggerEventDrop(
-      eventInstance,
-      // a drop doesn't necessarily mean a date mutation (ex: resource change)
-      (dateMutation && dateMutation.dateDelta) || createDuration(0),
-      revertFunc,
-      el, ev
-    )
-  }
-
-
-  // Triggers event-drop handlers that have subscribed via the API
-  triggerEventDrop(eventInstance, delta, revertFunc, el, ev) {
-    this.publiclyTrigger('eventDrop', [
-      {
-        el,
-        event: eventInstance.toLegacy(this.calendar),
-        delta,
-        revertFunc,
-        jsEvent: ev,
-        view: this
-      }
-    ])
-  }
-
-
-  /* External Element Drag-n-Drop
-  ------------------------------------------------------------------------------------------------------------------*/
-
-
-  // Must be called when an external element, via jQuery UI, has been dropped onto the calendar.
-  // `meta` is the parsed data that has been embedded into the dragging event.
-  // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
-  reportExternalDrop(singleEventDef, isEvent, isSticky, el, ev) {
-
-    if (isEvent) {
-      this.calendar.eventManager.addEventDef(singleEventDef, isSticky)
-    }
-
-    this.triggerExternalDrop(singleEventDef, isEvent, el, ev)
-  }
-
-
-  // Triggers external-drop handlers that have subscribed via the API
-  triggerExternalDrop(singleEventDef, isEvent, el, ev) {
-    const dateEnv = this.calendar.dateEnv
-
-    // trigger 'drop' regardless of whether element represents an event
-    this.publiclyTrigger('drop', [
-      {
-        date: dateEnv.toDate(singleEventDef.dateProfile.unzonedRange.start),
-        isAllDay: singleEventDef.dateProfile.isAllDay,
-        jsEvent: ev,
-        view: this
-      }
-    ])
-
-    if (isEvent) {
-      // signal an external event landed
-      this.publiclyTrigger('eventReceive', [
-        {
-          event: singleEventDef.buildInstance().toLegacy(this.calendar),
-          view: this
-        }
-      ])
-    }
-  }
-
-
-  /* Event Resizing
-  ------------------------------------------------------------------------------------------------------------------*/
-
-
-  // Must be called when an event in the view has been resized to a new length
-  reportEventResize(eventInstance, eventMutation, el, ev) {
-    let eventManager = this.calendar.eventManager
-    let revertFunc = eventManager.mutateEventsWithId(
-      eventInstance.def.id,
-      eventMutation
-    )
-
-    // update the EventInstance, for handlers
-    eventInstance.dateProfile = eventMutation.dateMutation.buildNewDateProfile(
-      eventInstance.dateProfile,
-      this.calendar
-    )
-
-    this.triggerEventResize(
-      eventInstance,
-      eventMutation.dateMutation.endDelta,
-      revertFunc,
-      el, ev
-    )
-  }
-
-
-  // Triggers event-resize handlers that have subscribed via the API
-  triggerEventResize(eventInstance, delta, revertFunc, el, ev) {
-    this.publiclyTrigger('eventResize', [
-      {
-        el,
-        event: eventInstance.toLegacy(this.calendar),
-        delta,
-        revertFunc,
-        jsEvent: ev,
-        view: this
-      }
-    ])
-  }
-
-
   /* Selection (time range)
   ------------------------------------------------------------------------------------------------------------------*/
 
@@ -753,13 +623,13 @@ export default abstract class View extends InteractiveDateComponent {
   selectEventInstance(eventInstance) {
     if (
       !this.selectedEventInstance ||
-      this.selectedEventInstance !== eventInstance
+      this.selectedEventInstance.instanceId !== eventInstance.instanceId
     ) {
       this.unselectEventInstance()
 
       this.getEventSegs().forEach(function(seg) {
         if (
-          seg.footprint.eventInstance === eventInstance &&
+          seg.eventRange.eventInstance.instanceId === eventInstance.instanceId &&
           seg.el // necessary?
         ) {
           seg.el.classList.add('fc-selected')
@@ -788,7 +658,7 @@ export default abstract class View extends InteractiveDateComponent {
   isEventDefSelected(eventDef) {
     // event references might change on refetchEvents(), while selectedEventInstance doesn't,
     // so compare IDs
-    return this.selectedEventInstance && this.selectedEventInstance.def.id === eventDef.id
+    return this.selectedEventInstance && this.selectedEventInstance.defId === eventDef.defId
   }
 
 
@@ -858,24 +728,6 @@ export default abstract class View extends InteractiveDateComponent {
   }
 
 
-  // Triggers handlers to 'dayClick'
-  // Span has start/end of the clicked area. Only the start is useful.
-  triggerDayClick(footprint, dayEl, ev) {
-    const dateEnv = this.calendar.dateEnv
-    let dateProfile = this.calendar.footprintToDateProfile(footprint) // abuse of "Event"DateProfile?
-
-    this.publiclyTrigger('dayClick', [
-      {
-        date: dateEnv.toDate(dateProfile.unzonedRange.start),
-        isAllDay: dateProfile.isAllDay,
-        el: dayEl,
-        jsEvent: ev,
-        view: this
-      }
-    ])
-  }
-
-
   /* Date Utils
   ------------------------------------------------------------------------------------------------------------------*/
 

+ 0 - 17
src/agenda/AgendaView.ts

@@ -285,23 +285,6 @@ export default class AgendaView extends View {
   }
 
 
-  /* Hit Areas
-  ------------------------------------------------------------------------------------------------------------------*/
-  // forward all hit-related method calls to the grids (dayGrid might not be defined)
-
-
-  getHitFootprint(hit) {
-    // TODO: hit.component is set as a hack to identify where the hit came from
-    return hit.component.getHitFootprint(hit)
-  }
-
-
-  getHitEl(hit) {
-    // TODO: hit.component is set as a hack to identify where the hit came from
-    return hit.component.getHitEl(hit)
-  }
-
-
   /* Event Rendering
   ------------------------------------------------------------------------------------------------------------------*/
 

+ 0 - 78
src/agenda/TimeGrid.ts

@@ -2,11 +2,9 @@ import { htmlEscape } from '../util/html'
 import { htmlToElement, findElements, createElement, removeElement, applyStyle } from '../util/dom-manip'
 import InteractiveDateComponent from '../component/InteractiveDateComponent'
 import BusinessHourRenderer from '../component/renderers/BusinessHourRenderer'
-import StandardInteractionsMixin from '../component/interactions/StandardInteractionsMixin'
 import { default as DayTableMixin, DayTableInterface } from '../component/DayTableMixin'
 import CoordCache from '../common/CoordCache'
 import UnzonedRange from '../models/UnzonedRange'
-import ComponentFootprint from '../models/ComponentFootprint'
 import TimeGridEventRenderer from './TimeGridEventRenderer'
 import TimeGridHelperRenderer from './TimeGridHelperRenderer'
 import TimeGridFillRenderer from './TimeGridFillRenderer'
@@ -583,81 +581,6 @@ export default class TimeGrid extends InteractiveDateComponent {
   }
 
 
-  /* Hit System
-  ------------------------------------------------------------------------------------------------------------------*/
-
-
-  prepareHits() {
-    this.colCoordCache.build()
-    this.slatCoordCache.build()
-  }
-
-
-  releaseHits() {
-    this.colCoordCache.clear()
-    // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop
-  }
-
-
-  queryHit(leftOffset, topOffset): any {
-    let snapsPerSlot = this.snapsPerSlot
-    let colCoordCache = this.colCoordCache
-    let slatCoordCache = this.slatCoordCache
-
-    if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) {
-      let colIndex = colCoordCache.getHorizontalIndex(leftOffset)
-      let slatIndex = slatCoordCache.getVerticalIndex(topOffset)
-
-      if (colIndex != null && slatIndex != null) {
-        let slatTop = slatCoordCache.getTopOffset(slatIndex)
-        let slatHeight = slatCoordCache.getHeight(slatIndex)
-        let partial = (topOffset - slatTop) / slatHeight // floating point number between 0 and 1
-        let localSnapIndex = Math.floor(partial * snapsPerSlot) // the snap # relative to start of slat
-        let snapIndex = slatIndex * snapsPerSlot + localSnapIndex
-        let snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight
-        let snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight
-
-        return {
-          col: colIndex,
-          snap: snapIndex,
-          component: this, // needed unfortunately :(
-          left: colCoordCache.getLeftOffset(colIndex),
-          right: colCoordCache.getRightOffset(colIndex),
-          top: snapTop,
-          bottom: snapBottom
-        }
-      }
-    }
-  }
-
-
-  getHitFootprint(hit) {
-    const dateEnv = this.view.calendar.dateEnv
-    let start = this.getCellDate(0, hit.col) // row=0
-    let timeMs = this.computeSnapTime(hit.snap) // pass in the snap-index
-    let end
-
-    start = addMs(start, timeMs)
-    end = dateEnv.add(start, this.snapDuration)
-
-    return new ComponentFootprint(
-      new UnzonedRange(start, end),
-      false // all-day?
-    )
-  }
-
-
-  // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day
-  computeSnapTime(snapIndex): number {
-    return asRoughMs(this.dateProfile.minTime) + asRoughMs(this.snapDuration) * snapIndex
-  }
-
-
-  getHitEl(hit) {
-    return this.colEls[hit.col]
-  }
-
-
   /* Event Drag Visualization
   ------------------------------------------------------------------------------------------------------------------*/
 
@@ -735,5 +658,4 @@ TimeGrid.prototype.businessHourRendererClass = BusinessHourRenderer
 TimeGrid.prototype.helperRendererClass = TimeGridHelperRenderer
 TimeGrid.prototype.fillRendererClass = TimeGridFillRenderer
 
-StandardInteractionsMixin.mixInto(TimeGrid)
 DayTableMixin.mixInto(TimeGrid)

+ 3 - 63
src/basic/DayGrid.ts

@@ -13,9 +13,7 @@ import View from '../View'
 import CoordCache from '../common/CoordCache'
 import Popover from '../common/Popover'
 import UnzonedRange from '../models/UnzonedRange'
-import ComponentFootprint from '../models/ComponentFootprint'
 import BusinessHourRenderer from '../component/renderers/BusinessHourRenderer'
-import StandardInteractionsMixin from '../component/interactions/StandardInteractionsMixin'
 import InteractiveDateComponent from '../component/InteractiveDateComponent'
 import { default as DayTableMixin, DayTableInterface } from '../component/DayTableMixin'
 import DayGridEventRenderer from './DayGridEventRenderer'
@@ -287,68 +285,11 @@ export default class DayGrid extends InteractiveDateComponent {
   }
 
 
-  /* Hit System
-  ------------------------------------------------------------------------------------------------------------------*/
-
-
-  prepareHits() {
-    this.colCoordCache.build()
-    this.rowCoordCache.build()
-    this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding // hack
-  }
-
-
-  releaseHits() {
-    this.colCoordCache.clear()
-    this.rowCoordCache.clear()
-  }
-
-
-  queryHit(leftOffset, topOffset) {
-    if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) {
-      let col = this.colCoordCache.getHorizontalIndex(leftOffset)
-      let row = this.rowCoordCache.getVerticalIndex(topOffset)
-
-      if (row != null && col != null) {
-        return this.getCellHit(row, col)
-      }
-    }
-  }
-
-
-  getHitFootprint(hit) {
-    let range = this.getCellRange(hit.row, hit.col)
-
-    return new ComponentFootprint(
-      new UnzonedRange(range.start, range.end),
-      true // all-day?
-    )
-  }
-
-
-  getHitEl(hit) {
-    return this.getCellEl(hit.row, hit.col)
-  }
-
-
   /* Cell System
   ------------------------------------------------------------------------------------------------------------------*/
   // FYI: the first column is the leftmost column, regardless of date
 
 
-  getCellHit(row, col): any {
-    return {
-      row: row,
-      col: col,
-      component: this, // needed unfortunately :(
-      left: this.colCoordCache.getLeftOffset(col),
-      right: this.colCoordCache.getRightOffset(col),
-      top: this.rowCoordCache.getTopOffset(row),
-      bottom: this.rowCoordCache.getBottomOffset(row)
-    }
-  }
-
-
   getCellEl(row, col) {
     return this.cellEls[row * this.colCnt + col]
   }
@@ -725,9 +666,9 @@ export default class DayGrid extends InteractiveDateComponent {
 
       // because segments in the popover are not part of a grid coordinate system, provide a hint to any
       // grids that want to do drag-n-drop about which cell it came from
-      this.hitsNeeded()
-      segs[i].hit = this.getCellHit(row, col)
-      this.hitsNotNeeded()
+      ////this.hitsNeeded()
+      ////segs[i].hit = this.getCellHit(row, col)
+      ////this.hitsNotNeeded()
 
       segContainer.appendChild(segs[i].el)
     }
@@ -811,5 +752,4 @@ DayGrid.prototype.businessHourRendererClass = BusinessHourRenderer
 DayGrid.prototype.helperRendererClass = DayGridHelperRenderer
 DayGrid.prototype.fillRendererClass = DayGridFillRenderer
 
-StandardInteractionsMixin.mixInto(DayGrid)
 DayTableMixin.mixInto(DayGrid)

+ 0 - 503
src/common/DragListener.ts

@@ -1,503 +0,0 @@
-import { getScrollParent } from '../util/dom-geom'
-import {
-  getEvIsTouch,
-  getEvX,
-  getEvY,
-  isPrimaryMouseButton,
-  preventDefault
-} from '../util/dom-event'
-import {
-  firstDefined,
-  preventSelection,
-  allowSelection,
-  debounce
-} from '../util/misc'
-import { default as ListenerMixin, ListenerInterface } from './ListenerMixin'
-import GlobalEmitter from './GlobalEmitter'
-
-
-export interface DragListenerOptions {
-  delay?: number
-  distance?: number
-  subjectEl?: HTMLElement
-  scroll?: boolean
-  [handlerName: string]: any
-}
-
-/* Tracks a drag's mouse movement, firing various handlers
-----------------------------------------------------------------------------------------------------------------------*/
-// TODO: use Emitter
-
-export default class DragListener {
-
-  listenTo: ListenerInterface['listenTo']
-  stopListeningTo: ListenerInterface['stopListeningTo']
-
-  options: DragListenerOptions
-  subjectEl: HTMLElement
-
-  // coordinates of the initial mousedown
-  originX: any
-  originY: any
-
-  // the wrapping element that scrolls, or MIGHT scroll if there's overflow.
-  // within the body. so, can't be the body/document/window. might be null
-  scrollEl: HTMLElement
-
-  isInteracting: boolean = false
-  isDistanceSurpassed: boolean = false
-  isDelayEnded: boolean = false
-  isDragging: boolean = false
-  isTouch: boolean = false
-  skipBinding: boolean = false // if true, don't watch mouse/touch events
-
-  delay: any
-  delayTimeoutId: any
-  minDistance: any
-
-  shouldCancelTouchScroll: boolean = true
-  scrollAlwaysKills: boolean = false
-
-  isAutoScroll: boolean = false
-
-  scrollBounds: any // { top, bottom, left, right }
-  scrollTopVel: any // pixels per second
-  scrollLeftVel: any // pixels per second
-  scrollIntervalId: any // ID of setTimeout for scrolling animation loop
-
-  // defaults
-  scrollSensitivity: number = 30 // pixels from edge for scrolling to start
-  scrollSpeed: number = 200 // pixels per second, at maximum speed
-  scrollIntervalMs: number = 50 // millisecond wait between scroll increment
-
-
-  constructor(options: DragListenerOptions) {
-    this.options = options || {}
-  }
-
-
-  // Interaction (high-level)
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  startInteraction(ev, extraOptions: any = {}) {
-
-    if (ev.type === 'mousedown') {
-      if (GlobalEmitter.get().shouldIgnoreMouse()) {
-        return
-      } else if (!isPrimaryMouseButton(ev)) {
-        return
-      } else {
-        ev.preventDefault() // prevents native selection in most browsers
-      }
-    }
-
-    if (!this.isInteracting) {
-
-      // process options
-      this.delay = firstDefined(extraOptions.delay, this.options.delay, 0)
-      this.minDistance = firstDefined(extraOptions.distance, this.options.distance, 0)
-      this.subjectEl = this.options.subjectEl
-
-      preventSelection(document.body)
-
-      this.isInteracting = true
-      this.isTouch = getEvIsTouch(ev)
-      this.isDelayEnded = false
-      this.isDistanceSurpassed = false
-
-      this.originX = getEvX(ev)
-      this.originY = getEvY(ev)
-      this.scrollEl = getScrollParent(ev.target)
-
-      this.bindHandlers()
-      this.initAutoScroll()
-      this.handleInteractionStart(ev)
-      this.startDelay(ev)
-
-      if (!this.minDistance) {
-        this.handleDistanceSurpassed(ev)
-      }
-    }
-  }
-
-
-  handleInteractionStart(ev) {
-    this.trigger('interactionStart', ev)
-  }
-
-
-  endInteraction(ev, isCancelled) {
-    if (this.isInteracting) {
-      this.endDrag(ev)
-
-      if (this.delayTimeoutId) {
-        clearTimeout(this.delayTimeoutId)
-        this.delayTimeoutId = null
-      }
-
-      this.destroyAutoScroll()
-      this.unbindHandlers()
-
-      this.isInteracting = false
-      this.handleInteractionEnd(ev, isCancelled)
-
-      allowSelection(document.body)
-    }
-  }
-
-
-  handleInteractionEnd(ev, isCancelled) {
-    this.trigger('interactionEnd', ev, isCancelled || false)
-  }
-
-
-  // Binding To DOM
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  bindHandlers() {
-    // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart,
-    // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly.
-    let globalEmitter = GlobalEmitter.get()
-
-    if (this.skipBinding) {
-      //
-    } else if (this.isTouch) {
-      this.listenTo(globalEmitter, {
-        touchmove: this.handleTouchMove,
-        touchend: this.endInteraction,
-        scroll: this.handleTouchScroll
-      })
-    } else {
-      this.listenTo(globalEmitter, {
-        mousemove: this.handleMouseMove,
-        mouseup: this.endInteraction
-      })
-    }
-
-    this.listenTo(globalEmitter, {
-      selectstart: preventDefault, // don't allow selection while dragging
-      contextmenu: preventDefault // long taps would open menu on Chrome dev tools
-    })
-  }
-
-
-  unbindHandlers() {
-    this.stopListeningTo(GlobalEmitter.get())
-  }
-
-
-  // Drag (high-level)
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  // extraOptions ignored if drag already started
-  startDrag(ev, extraOptions?) {
-    this.startInteraction(ev, extraOptions) // ensure interaction began
-
-    if (!this.isDragging) {
-      this.isDragging = true
-      this.handleDragStart(ev)
-    }
-  }
-
-
-  handleDragStart(ev) {
-    this.trigger('dragStart', ev)
-  }
-
-
-  handleMove(ev) {
-    let dx = getEvX(ev) - this.originX
-    let dy = getEvY(ev) - this.originY
-    let minDistance = this.minDistance
-    let distanceSq // current distance from the origin, squared
-
-    if (!this.isDistanceSurpassed) {
-      distanceSq = dx * dx + dy * dy
-      if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem
-        this.handleDistanceSurpassed(ev)
-      }
-    }
-
-    if (this.isDragging) {
-      this.handleDrag(dx, dy, ev)
-    }
-  }
-
-
-  // Called while the mouse is being moved and when we know a legitimate drag is taking place
-  handleDrag(dx, dy, ev) {
-    this.trigger('drag', dx, dy, ev)
-    this.updateAutoScroll(ev) // will possibly cause scrolling
-  }
-
-
-  endDrag(ev) {
-    if (this.isDragging) {
-      this.isDragging = false
-      this.handleDragEnd(ev)
-    }
-  }
-
-
-  handleDragEnd(ev) {
-    this.trigger('dragEnd', ev)
-  }
-
-
-  // Delay
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  startDelay(initialEv) {
-    if (this.delay) {
-      this.delayTimeoutId = setTimeout(() => {
-        this.handleDelayEnd(initialEv)
-      }, this.delay)
-    } else {
-      this.handleDelayEnd(initialEv)
-    }
-  }
-
-
-  handleDelayEnd(initialEv) {
-    this.isDelayEnded = true
-
-    if (this.isDistanceSurpassed) {
-      this.startDrag(initialEv)
-    }
-  }
-
-
-  // Distance
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  handleDistanceSurpassed(ev) {
-    this.isDistanceSurpassed = true
-
-    if (this.isDelayEnded) {
-      this.startDrag(ev)
-    }
-  }
-
-
-  // Mouse / Touch
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  handleTouchMove(ev) {
-
-    // prevent inertia and touchmove-scrolling while dragging
-    if (this.isDragging && this.shouldCancelTouchScroll) {
-      ev.preventDefault()
-    }
-
-    this.handleMove(ev)
-  }
-
-
-  handleMouseMove(ev) {
-    this.handleMove(ev)
-  }
-
-
-  // Scrolling (unrelated to auto-scroll)
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  handleTouchScroll(ev) {
-    // if the drag is being initiated by touch, but a scroll happens before
-    // the drag-initiating delay is over, cancel the drag
-    if (!this.isDragging || this.scrollAlwaysKills) {
-      this.endInteraction(ev, true) // isCancelled=true
-    }
-  }
-
-
-  // Utils
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  // Triggers a callback. Calls a function in the option hash of the same name.
-  // Arguments beyond the first `name` are forwarded on.
-  trigger(name, ...args) {
-    if (this.options[name]) {
-      this.options[name].apply(this, args)
-    }
-    // makes _methods callable by event name. TODO: kill this
-    if (this['_' + name]) {
-      this['_' + name].apply(this, args)
-    }
-  }
-
-
-  // Auto-scroll
-  // -----------------------------------------------------------------------------------------------------------------
-
-
-  initAutoScroll() {
-    let scrollEl = this.scrollEl
-
-    this.isAutoScroll = Boolean(this.options.scroll && scrollEl)
-
-    if (this.isAutoScroll) {
-      // debounce makes sure rapid calls don't happen
-      this.listenTo(scrollEl, 'scroll', debounce(this.handleDebouncedScroll, 100))
-    }
-  }
-
-
-  destroyAutoScroll() {
-    this.endAutoScroll() // kill any animation loop
-
-    // remove the scroll handler if there is a scrollEl
-    if (this.isAutoScroll) {
-      this.stopListeningTo(this.scrollEl, 'scroll') // will probably get removed by unbindHandlers too :(
-    }
-  }
-
-
-  // Computes and stores the bounding rectangle of scrollEl
-  computeScrollBounds() {
-    if (this.isAutoScroll) {
-      this.scrollBounds = this.scrollEl.getBoundingClientRect()
-      // TODO: use computeInnerRect in future. but prevents auto scrolling when on top of scrollbars
-    }
-  }
-
-
-  // Called when the dragging is in progress and scrolling should be updated
-  updateAutoScroll(ev) {
-    let sensitivity = this.scrollSensitivity
-    let bounds = this.scrollBounds
-    let topCloseness
-    let bottomCloseness
-    let leftCloseness
-    let rightCloseness
-    let topVel = 0
-    let leftVel = 0
-
-    if (bounds) { // only scroll if scrollEl exists
-
-      // compute closeness to edges. valid range is from 0.0 - 1.0
-      topCloseness = (sensitivity - (getEvY(ev) - bounds.top)) / sensitivity
-      bottomCloseness = (sensitivity - (bounds.bottom - getEvY(ev))) / sensitivity
-      leftCloseness = (sensitivity - (getEvX(ev) - bounds.left)) / sensitivity
-      rightCloseness = (sensitivity - (bounds.right - getEvX(ev))) / sensitivity
-
-      // translate vertical closeness into velocity.
-      // mouse must be completely in bounds for velocity to happen.
-      if (topCloseness >= 0 && topCloseness <= 1) {
-        topVel = topCloseness * this.scrollSpeed * -1 // negative. for scrolling up
-      } else if (bottomCloseness >= 0 && bottomCloseness <= 1) {
-        topVel = bottomCloseness * this.scrollSpeed
-      }
-
-      // translate horizontal closeness into velocity
-      if (leftCloseness >= 0 && leftCloseness <= 1) {
-        leftVel = leftCloseness * this.scrollSpeed * -1 // negative. for scrolling left
-      } else if (rightCloseness >= 0 && rightCloseness <= 1) {
-        leftVel = rightCloseness * this.scrollSpeed
-      }
-    }
-
-    this.setScrollVel(topVel, leftVel)
-  }
-
-
-  // Sets the speed-of-scrolling for the scrollEl
-  setScrollVel(topVel, leftVel) {
-
-    this.scrollTopVel = topVel
-    this.scrollLeftVel = leftVel
-
-    this.constrainScrollVel() // massages into realistic values
-
-    // if there is non-zero velocity, and an animation loop hasn't already started, then START
-    if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) {
-      this.scrollIntervalId = setInterval(
-        this.scrollIntervalFunc.bind(this),
-        this.scrollIntervalMs
-      )
-    }
-  }
-
-
-  // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way
-  constrainScrollVel() {
-    let el = this.scrollEl
-
-    if (this.scrollTopVel < 0) { // scrolling up?
-      if (el.scrollTop <= 0) { // already scrolled all the way up?
-        this.scrollTopVel = 0
-      }
-    } else if (this.scrollTopVel > 0) { // scrolling down?
-      if (el.scrollTop + el.clientHeight >= el.scrollHeight) { // already scrolled all the way down?
-        this.scrollTopVel = 0
-      }
-    }
-
-    if (this.scrollLeftVel < 0) { // scrolling left?
-      if (el.scrollLeft <= 0) { // already scrolled all the left?
-        this.scrollLeftVel = 0
-      }
-    } else if (this.scrollLeftVel > 0) { // scrolling right?
-      if (el.scrollLeft + el.clientWidth >= el.scrollWidth) { // already scrolled all the way right?
-        this.scrollLeftVel = 0
-      }
-    }
-  }
-
-
-  // This function gets called during every iteration of the scrolling animation loop
-  scrollIntervalFunc() {
-    let el = this.scrollEl
-    let frac = this.scrollIntervalMs / 1000 // considering animation frequency, what the vel should be mult'd by
-
-    // change the value of scrollEl's scroll
-    if (this.scrollTopVel) {
-      el.scrollTop = el.scrollTop + this.scrollTopVel * frac
-    }
-    if (this.scrollLeftVel) {
-      el.scrollLeft = el.scrollLeft + this.scrollLeftVel * frac
-    }
-
-    this.constrainScrollVel() // since the scroll values changed, recompute the velocities
-
-    // if scrolled all the way, which causes the vels to be zero, stop the animation loop
-    if (!this.scrollTopVel && !this.scrollLeftVel) {
-      this.endAutoScroll()
-    }
-  }
-
-
-  // Kills any existing scrolling animation loop
-  endAutoScroll() {
-    if (this.scrollIntervalId) {
-      clearInterval(this.scrollIntervalId)
-      this.scrollIntervalId = null
-
-      this.handleScrollEnd()
-    }
-  }
-
-
-  // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce)
-  handleDebouncedScroll() {
-    // recompute all coordinates, but *only* if this is *not* part of our scrolling animation
-    if (!this.scrollIntervalId) {
-      this.handleScrollEnd()
-    }
-  }
-
-
-  handleScrollEnd() {
-    // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
-  }
-
-}
-
-ListenerMixin.mixInto(DragListener)

+ 0 - 220
src/common/HitDragListener.ts

@@ -1,220 +0,0 @@
-import {
-  constrainPoint,
-  intersectRects,
-  getRectCenter,
-  diffPoints
-} from '../util/geom'
-import { getEvX, getEvY } from '../util/dom-event'
-import { default as DragListener, DragListenerOptions } from './DragListener'
-
-
-export interface HitDragListenerOptions extends DragListenerOptions {
-  subjectCenter?: boolean
-}
-
-
-/* Tracks mouse movements over a component and raises events about which hit the mouse is over.
-------------------------------------------------------------------------------------------------------------------------
-*/
-
-export default class HitDragListener extends DragListener {
-
-  options: HitDragListenerOptions
-  component: any // converts coordinates to hits
-    // methods: hitsNeeded, hitsNotNeeded, queryHit
-
-  origHit: any // the hit the mouse was over when listening started
-  hit: any // the hit the mouse is over
-  coordAdjust: any // delta that will be added to the mouse coordinates when computing collisions
-
-
-  constructor(component, options: HitDragListenerOptions) {
-    super(options)
-    this.component = component
-  }
-
-  // Called when drag listening starts (but a real drag has not necessarily began).
-  // ev might be undefined if dragging was started manually.
-  handleInteractionStart(ev) {
-    let subjectEl = this.subjectEl
-    let subjectRect
-    let origPoint
-    let point
-
-    this.component.hitsNeeded()
-    this.computeScrollBounds() // for autoscroll
-
-    if (ev) {
-      origPoint = { left: getEvX(ev), top: getEvY(ev) }
-      point = origPoint
-
-      // constrain the point to bounds of the element being dragged
-      if (subjectEl) {
-        subjectRect = subjectEl.getBoundingClientRect() // used for centering as well
-        point = constrainPoint(point, subjectRect)
-      }
-
-      this.origHit = this.queryHit(point.left, point.top)
-
-      // treat the center of the subject as the collision point?
-      if (subjectEl && this.options.subjectCenter) {
-
-        // only consider the area the subject overlaps the hit. best for large subjects.
-        // TODO: skip this if hit didn't supply left/right/top/bottom
-        if (this.origHit) {
-          subjectRect = intersectRects(this.origHit, subjectRect) ||
-            subjectRect // in case there is no intersection
-        }
-
-        point = getRectCenter(subjectRect)
-      }
-
-      this.coordAdjust = diffPoints(point, origPoint) // point - origPoint
-    } else {
-      this.origHit = null
-      this.coordAdjust = null
-    }
-
-    // call the super-method. do it after origHit has been computed
-    super.handleInteractionStart(ev)
-  }
-
-
-  // Called when the actual drag has started
-  handleDragStart(ev) {
-    let hit
-
-    super.handleDragStart(ev)
-
-    // might be different from this.origHit if the min-distance is large
-    hit = this.queryHit(getEvX(ev), getEvY(ev))
-
-    // report the initial hit the mouse is over
-    // especially important if no min-distance and drag starts immediately
-    if (hit) {
-      this.handleHitOver(hit)
-    }
-  }
-
-
-  // Called when the drag moves
-  handleDrag(dx, dy, ev) {
-    let hit
-
-    super.handleDrag(dx, dy, ev)
-
-    hit = this.queryHit(getEvX(ev), getEvY(ev))
-
-    if (!isHitsEqual(hit, this.hit)) { // a different hit than before?
-      if (this.hit) {
-        this.handleHitOut()
-      }
-      if (hit) {
-        this.handleHitOver(hit)
-      }
-    }
-  }
-
-
-  // Called when dragging has been stopped
-  handleDragEnd(ev) {
-    this.handleHitDone()
-    super.handleDragEnd(ev)
-  }
-
-
-  // Called when a the mouse has just moved over a new hit
-  handleHitOver(hit) {
-    let isOrig = isHitsEqual(hit, this.origHit)
-
-    this.hit = hit
-
-    this.trigger('hitOver', this.hit, isOrig, this.origHit)
-  }
-
-
-  // Called when the mouse has just moved out of a hit
-  handleHitOut() {
-    if (this.hit) {
-      this.trigger('hitOut', this.hit)
-      this.handleHitDone()
-      this.hit = null
-    }
-  }
-
-
-  // Called after a hitOut. Also called before a dragStop
-  handleHitDone() {
-    if (this.hit) {
-      this.trigger('hitDone', this.hit)
-    }
-  }
-
-
-  // Called when the interaction ends, whether there was a real drag or not
-  handleInteractionEnd(ev, isCancelled) {
-    super.handleInteractionEnd(ev, isCancelled)
-
-    this.origHit = null
-    this.hit = null
-
-    this.component.hitsNotNeeded()
-  }
-
-
-  // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
-  handleScrollEnd() {
-    super.handleScrollEnd()
-
-    // hits' absolute positions will be in new places after a user's scroll.
-    // HACK for recomputing.
-    if (this.isDragging) {
-      this.component.releaseHits()
-      this.component.prepareHits()
-    }
-  }
-
-
-  // Gets the hit underneath the coordinates for the given mouse event
-  queryHit(left, top) {
-
-    if (this.coordAdjust) {
-      left += this.coordAdjust.left
-      top += this.coordAdjust.top
-    }
-
-    return this.component.queryHit(left, top)
-  }
-
-}
-
-
-// Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component.
-// Two null values will be considered equal, as two "out of the component" states are the same.
-function isHitsEqual(hit0, hit1) {
-
-  if (!hit0 && !hit1) {
-    return true
-  }
-
-  if (hit0 && hit1) {
-    return hit0.component === hit1.component &&
-      isHitPropsWithin(hit0, hit1) &&
-      isHitPropsWithin(hit1, hit0) // ensures all props are identical
-  }
-
-  return false
-}
-
-
-// Returns true if all of subHit's non-standard properties are within superHit
-function isHitPropsWithin(subHit, superHit) {
-  for (let propName in subHit) {
-    if (!/^(component|left|right|top|bottom)$/.test(propName)) {
-      if (subHit[propName] !== superHit[propName]) {
-        return false
-      }
-    }
-  }
-  return true
-}

+ 0 - 80
src/component/DateComponent.ts

@@ -32,8 +32,6 @@ export default abstract class DateComponent extends Component {
   businessHourRenderer: any
   fillRenderer: any
 
-  hitsNeededDepth: number = 0 // necessary because multiple callers might need the same hits
-
   hasAllDayBusinessHours: boolean = false // TODO: unify with largeUnit and isTimeScale?
 
   isDatesRendered: boolean = false
@@ -481,84 +479,6 @@ export default abstract class DateComponent extends Component {
   }
 
 
-  // Hit Areas
-  // ---------------------------------------------------------------------------------------------------------------
-  // just because all DateComponents support this interface
-  // doesn't mean they need to have their own internal coord system. they can defer to sub-components.
-
-
-  hitsNeeded() {
-    if (!(this.hitsNeededDepth++)) {
-      this.prepareHits()
-    }
-
-    this.callChildren('hitsNeeded', arguments)
-  }
-
-
-  hitsNotNeeded() {
-    if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) {
-      this.releaseHits()
-    }
-
-    this.callChildren('hitsNotNeeded', arguments)
-  }
-
-
-  prepareHits() {
-    // subclasses can implement
-  }
-
-
-  releaseHits() {
-    // subclasses can implement
-  }
-
-
-  // Given coordinates from the topleft of the document, return data about the date-related area underneath.
-  // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged).
-  // Must have a `grid` property, a reference to this current grid. TODO: avoid this
-  // The returned object will be processed by getHitFootprint and getHitEl.
-  queryHit(leftOffset, topOffset) {
-    let childrenByUid = this.childrenByUid
-    let uid
-    let hit
-
-    for (uid in childrenByUid) {
-      hit = childrenByUid[uid].queryHit(leftOffset, topOffset)
-
-      if (hit) {
-        break
-      }
-    }
-
-    return hit
-  }
-
-
-  getSafeHitFootprint(hit) {
-    let footprint = this.getHitFootprint(hit)
-
-    if (!this.dateProfile.activeUnzonedRange.containsRange(footprint.unzonedRange)) {
-      return null
-    }
-
-    return footprint
-  }
-
-
-  getHitFootprint(hit): any {
-    // what about being abstract!?
-  }
-
-
-  // Given position-level information about a date-related area within the grid,
-  // should return an element that best represents it. passed to dayClick callback.
-  getHitEl(hit): HTMLElement | null {
-    return null
-  }
-
-
   /* Converting selection/eventRanges -> segs
   ------------------------------------------------------------------------------------------------------------------*/
 

+ 15 - 212
src/component/InteractiveDateComponent.ts

@@ -2,27 +2,13 @@ import { elementClosest } from '../util/dom-manip'
 import { getEvIsTouch, listenBySelector, listenToHoverBySelector } from '../util/dom-event'
 import DateComponent from './DateComponent'
 import GlobalEmitter from '../common/GlobalEmitter'
-import { diffDayAndTime, diffWholeWeeks } from '../datelib/marker'
-import { Duration, createDuration } from '../datelib/duration'
-import { EventRenderRange } from '../reducers/event-rendering'
 
 
+/*
+NOTE: still needed for event element clicking and drag initiation
+*/
 export default abstract class InteractiveDateComponent extends DateComponent {
 
-  dateClickingClass: any
-  dateSelectingClass: any
-  eventPointingClass: any
-  eventDraggingClass: any
-  eventResizingClass: any
-  externalDroppingClass: any
-
-  dateClicking: any
-  dateSelecting: any
-  eventPointing: any
-  eventDragging: any
-  eventResizing: any
-  externalDropping: any
-
   // self-config, overridable by subclasses
   segSelector: string = '.fc-event-container > *' // what constitutes an event element?
 
@@ -32,48 +18,11 @@ export default abstract class InteractiveDateComponent extends DateComponent {
   largeUnit: any
 
 
-  constructor(_view?, _options?) {
-    super(_view, _options)
-
-    if (this.dateSelectingClass) {
-      this.dateClicking = new this.dateClickingClass(this)
-    }
-
-    if (this.dateSelectingClass) {
-      this.dateSelecting = new this.dateSelectingClass(this)
-    }
-
-    if (this.eventPointingClass) {
-      this.eventPointing = new this.eventPointingClass(this)
-    }
-
-    if (this.eventDraggingClass && this.eventPointing) {
-      this.eventDragging = new this.eventDraggingClass(this, this.eventPointing)
-    }
-
-    if (this.eventResizingClass && this.eventPointing) {
-      this.eventResizing = new this.eventResizingClass(this, this.eventPointing)
-    }
-
-    if (this.externalDroppingClass) {
-      this.externalDropping = new this.externalDroppingClass(this)
-    }
-  }
-
-
   // Sets the container element that the view should render inside of, does global DOM-related initializations,
   // and renders all the non-date-related content inside.
   setElement(el) {
     super.setElement(el)
 
-    if (this.dateClicking) {
-      this.dateClicking.bindToEl(el)
-    }
-
-    if (this.dateSelecting) {
-      this.dateSelecting.bindToEl(el)
-    }
-
     this.bindAllSegHandlersToEl(el)
   }
 
@@ -109,15 +58,7 @@ export default abstract class InteractiveDateComponent extends DateComponent {
 
 
   bindAllSegHandlersToEl(el) {
-    [
-      this.eventPointing,
-      this.eventDragging,
-      this.eventResizing
-    ].forEach(function(eventInteraction) {
-      if (eventInteraction) {
-        eventInteraction.bindToEl(el)
-      }
-    })
+    // TODO
   }
 
 
@@ -173,28 +114,30 @@ export default abstract class InteractiveDateComponent extends DateComponent {
 
   shouldIgnoreEventPointing() {
     // only call the handlers if there is not a drag/resize in progress
-    return (this.eventDragging && this.eventDragging.isDragging) ||
-      (this.eventResizing && this.eventResizing.isResizing)
+
+    return false
+    // return (this.eventDragging && this.eventDragging.isDragging) ||
+    //   (this.eventResizing && this.eventResizing.isResizing)
   }
 
 
   canStartSelection(seg, ev) {
     return getEvIsTouch(ev) &&
       !this.canStartResize(seg, ev) &&
-      (this.isEventDefDraggable(seg.footprint.eventDef) ||
-        this.isEventDefResizable(seg.footprint.eventDef))
+      (this.isEventDefDraggable(seg.eventRange.eventDef) ||
+        this.isEventDefResizable(seg.eventRange.eventDef))
   }
 
 
   canStartDrag(seg, ev) {
     return !this.canStartResize(seg, ev) &&
-      this.isEventDefDraggable(seg.footprint.eventDef)
+      this.isEventDefDraggable(seg.eventRange.eventDef)
   }
 
 
   canStartResize(seg, ev) {
     let view = this._getView()
-    let eventDef = seg.footprint.eventDef
+    let eventDef = seg.eventRange.eventDef
 
     return (!getEvIsTouch(ev) || view.isEventDefSelected(eventDef)) &&
       this.isEventDefResizable(eventDef) &&
@@ -206,17 +149,6 @@ export default abstract class InteractiveDateComponent extends DateComponent {
   // Useful for when public API methods that result in re-rendering are invoked during a drag.
   // Also useful for when touch devices misbehave and don't fire their touchend.
   endInteractions() {
-    [
-      this.dateClicking,
-      this.dateSelecting,
-      this.eventPointing,
-      this.eventDragging,
-      this.eventResizing
-    ].forEach(function(interaction) {
-      if (interaction) {
-        interaction.end()
-      }
-    })
   }
 
 
@@ -231,61 +163,15 @@ export default abstract class InteractiveDateComponent extends DateComponent {
 
 
   isEventDefStartEditable(eventDef) {
-    let isEditable = eventDef.isStartExplicitlyEditable()
-
-    if (isEditable == null) {
-      isEditable = this.opt('eventStartEditable')
-
-      if (isEditable == null) {
-        isEditable = this.isEventDefGenerallyEditable(eventDef)
-      }
-    }
-
-    return isEditable
+    return false // TODO
   }
 
 
   isEventDefGenerallyEditable(eventDef) {
-    let isEditable = eventDef.isExplicitlyEditable()
-
-    if (isEditable == null) {
-      isEditable = this.opt('editable')
-    }
-
-    return isEditable
+    return false // TODO
   }
 
 
-  // EXTERNAL Drag-n-Drop
-  // ---------------------------------------------------------------------------------------------------------------
-
-
-  handlExternalDragStart(ev, el, skipBinding) {
-    if (this.externalDropping) {
-      this.externalDropping.handleDragStart(ev, el, skipBinding)
-    }
-
-    super.handlExternalDragStart(ev, el, skipBinding)
-  }
-
-
-  handleExternalDragMove(ev) {
-    if (this.externalDropping) {
-      this.externalDropping.handleDragMove(ev)
-    }
-
-    super.handleExternalDragMove(ev)
-  }
-
-
-  handleExternalDragStop(ev) {
-    if (this.externalDropping) {
-      this.externalDropping.handleDragStop(ev)
-    }
-
-    super.handleExternalDragStop(ev)
-  }
-
 
   // Event Resizing
   // ---------------------------------------------------------------------------------------------------------------
@@ -305,90 +191,7 @@ export default abstract class InteractiveDateComponent extends DateComponent {
 
   // Computes if the given event is allowed to be resized by the user at all
   isEventDefResizable(eventDef) {
-    let isResizable = eventDef.isDurationExplicitlyEditable()
-
-    if (isResizable == null) {
-      isResizable = this.opt('eventDurationEditable')
-
-      if (isResizable == null) {
-        isResizable = this.isEventDefGenerallyEditable(eventDef)
-      }
-    }
-    return isResizable
-  }
-
-
-  // Event Mutation / Constraints
-  // ---------------------------------------------------------------------------------------------------------------
-
-
-  // Diffs the two dates, returning a duration, based on granularity of the grid
-  // TODO: port isTimeScale into this system?
-  diffDates(a, b): Duration {
-    const dateEnv = this._getCalendar().dateEnv
-
-    if (!this.largeUnit) {
-      return diffDayAndTime(a, b) // returns a duration
-    } else if (this.largeUnit === 'week') {
-      return createDuration(diffWholeWeeks(a, b), 'week')
-    } else if (this.largeUnit === 'month') {
-      return createDuration(dateEnv.diffWholeMonths(a, b), 'month')
-    } else if (this.largeUnit === 'year') {
-      return createDuration(dateEnv.diffWholeYears(a, b), 'year')
-    }
-  }
-
-
-  // is it allowed, in relation to the view's validRange?
-  isEventRangesAllowed(eventRanges: EventRenderRange[]) {
-    let view = this._getView()
-    let dateProfile = this.dateProfile
-
-    for (let eventRange of eventRanges) {
-      if (!dateProfile.validUnzonedRange.containsRange(eventRange.range)) {
-        return false
-      }
-    }
-
-    return view.calendar.constraints.isEventRangesAllowed(eventRanges)
-  }
-
-
-  // NOTE: very similar to isEventRangesAllowed
-  // when it's a completely anonymous external drag, no event.
-  isExternalRangesAllowed(eventRanges: EventRenderRange[]) {
-    let dateProfile = this.dateProfile
-
-    for (let eventRange of eventRanges) {
-      if (!dateProfile.validUnzonedRange.containsRange(eventRange.range)) {
-        return false
-      }
-    }
-
-    // let view = this._getView()
-    //
-    // for (let eventRange of eventRanges) {
-    //   // treat it as a selection
-    //   // TODO: pass in eventRanges instead
-    //   //  because we don't want calendar's constraint system to depend on a component's
-    //   //  determination of footprints.
-    //   if (!view.calendar.constraints.isSelectionFootprintAllowed(WHAT)) {
-    //     return false
-    //   }
-    // }
-
-    return true
-  }
-
-
-  // TODO: constraint API
-
-  isSelectionAllowed(selection) {
-    return false
-  }
-
-  isRangeAllowed(range, overlap, constraint, eventDef, selection) {
-    return false
+    return false // TODO
   }
 
 }

+ 0 - 86
src/component/interactions/DateClicking.ts

@@ -1,86 +0,0 @@
-import HitDragListener from '../../common/HitDragListener'
-import Interaction from './Interaction'
-
-
-export default class DateClicking extends Interaction {
-
-  dragListener: any
-
-
-  /*
-  component must implement:
-    - bindDateHandlerToEl
-    - getSafeHitFootprint
-    - getHitEl
-  */
-  constructor(component) {
-    super(component)
-    this.dragListener = this.buildDragListener()
-  }
-
-
-  end() {
-    this.dragListener.endInteraction()
-  }
-
-
-  bindToEl(el) {
-    let component = this.component
-    let dragListener = this.dragListener
-
-    component.bindDateHandlerToEl(el, 'mousedown', function(ev) {
-      if (!component.shouldIgnoreMouse()) {
-        dragListener.startInteraction(ev)
-      }
-    })
-
-    component.bindDateHandlerToEl(el, 'touchstart', function(ev) {
-      if (!component.shouldIgnoreTouch()) {
-        dragListener.startInteraction(ev)
-      }
-    })
-  }
-
-
-  // Creates a listener that tracks the user's drag across day elements, for day clicking.
-  buildDragListener() {
-    let component = this.component
-    let dayClickHit // null if invalid dayClick
-
-    let dragListener = new HitDragListener(component, {
-      scroll: this.opt('dragScroll'),
-      interactionStart: () => {
-        dayClickHit = dragListener.origHit
-      },
-      hitOver: (hit, isOrig, origHit) => {
-        // if user dragged to another cell at any point, it can no longer be a dayClick
-        if (!isOrig) {
-          dayClickHit = null
-        }
-      },
-      hitOut: () => { // called before mouse moves to a different hit OR moved out of all hits
-        dayClickHit = null
-      },
-      interactionEnd: (ev, isCancelled) => {
-        let componentFootprint
-
-        if (!isCancelled && dayClickHit) {
-          componentFootprint = component.getSafeHitFootprint(dayClickHit)
-
-          if (componentFootprint) {
-            this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev)
-          }
-        }
-      }
-    })
-
-    // because dragListener won't be called with any time delay, "dragging" will begin immediately,
-    // which will kill any touchmoving/scrolling. Prevent this.
-    dragListener.shouldCancelTouchScroll = false
-
-    dragListener.scrollAlwaysKills = true
-
-    return dragListener
-  }
-
-}

+ 0 - 160
src/component/interactions/DateSelecting.ts

@@ -1,160 +0,0 @@
-import { enableCursor, disableCursor, preventSelection, compareNumbers } from '../../util/misc'
-import HitDragListener from '../../common/HitDragListener'
-import ComponentFootprint from '../../models/ComponentFootprint'
-import UnzonedRange from '../../models/UnzonedRange'
-import Interaction from './Interaction'
-
-
-export default class DateSelecting extends Interaction {
-
-  dragListener: any
-
-
-  /*
-  component must implement:
-    - bindDateHandlerToEl
-    - getSafeHitFootprint
-    - renderHighlight
-    - unrenderHighlight
-  */
-  constructor(component) {
-    super(component)
-    this.dragListener = this.buildDragListener()
-  }
-
-
-  end() {
-    this.dragListener.endInteraction()
-  }
-
-
-  getDelay() {
-    let delay = this.opt('selectLongPressDelay')
-
-    if (delay == null) {
-      delay = this.opt('longPressDelay') // fallback
-    }
-
-    return delay
-  }
-
-
-  bindToEl(el) {
-    let component = this.component
-    let dragListener = this.dragListener
-
-    component.bindDateHandlerToEl(el, 'mousedown', (ev) => {
-      if (this.opt('selectable') && !component.shouldIgnoreMouse()) {
-        dragListener.startInteraction(ev, {
-          distance: this.opt('selectMinDistance')
-        })
-      }
-    })
-
-    component.bindDateHandlerToEl(el, 'touchstart', (ev) => {
-      if (this.opt('selectable') && !component.shouldIgnoreTouch()) {
-        dragListener.startInteraction(ev, {
-          delay: this.getDelay()
-        })
-      }
-    })
-
-    preventSelection(el)
-  }
-
-
-  // Creates a listener that tracks the user's drag across day elements, for day selecting.
-  buildDragListener() {
-    let component = this.component
-    let selectionFootprint // null if invalid selection
-
-    let dragListener = new HitDragListener(component, {
-      scroll: this.opt('dragScroll'),
-      interactionStart: () => {
-        selectionFootprint = null
-      },
-      dragStart: (ev) => {
-        this.view.unselect(ev) // since we could be rendering a new selection, we want to clear any old one
-      },
-      hitOver: (hit, isOrig, origHit) => {
-        let origHitFootprint
-        let hitFootprint
-
-        if (origHit) { // click needs to have started on a hit
-
-          origHitFootprint = component.getSafeHitFootprint(origHit)
-          hitFootprint = component.getSafeHitFootprint(hit)
-
-          if (origHitFootprint && hitFootprint) {
-            selectionFootprint = this.computeSelection(origHitFootprint, hitFootprint)
-          } else {
-            selectionFootprint = null
-          }
-
-          if (selectionFootprint) {
-            component.renderSelectionFootprint(selectionFootprint)
-          } else if (selectionFootprint === false) {
-            disableCursor()
-          }
-        }
-      },
-      hitOut: () => { // called before mouse moves to a different hit OR moved out of all hits
-        selectionFootprint = null
-        component.unrenderSelection()
-      },
-      hitDone: () => { // called after a hitOut OR before a dragEnd
-        enableCursor()
-      },
-      interactionEnd: (ev, isCancelled) => {
-        if (!isCancelled && selectionFootprint) {
-          // the selection will already have been rendered. just report it
-          this.view.reportSelection(selectionFootprint, ev)
-        }
-      }
-    })
-
-    return dragListener
-  }
-
-
-  // Given the first and last date-spans of a selection, returns another date-span object.
-  // Subclasses can override and provide additional data in the span object. Will be passed to renderSelectionFootprint().
-  // Will return false if the selection is invalid and this should be indicated to the user.
-  // Will return null/undefined if a selection invalid but no error should be reported.
-  computeSelection(footprint0, footprint1) {
-    let wholeFootprint = this.computeSelectionFootprint(footprint0, footprint1)
-
-    if (wholeFootprint && !this.isSelectionFootprintAllowed(wholeFootprint)) {
-      return false
-    }
-
-    return wholeFootprint
-  }
-
-
-  // Given two spans, must return the combination of the two.
-  // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too.
-  // Assumes both footprints are non-open-ended.
-  computeSelectionFootprint(footprint0, footprint1) {
-    let markers = [
-      footprint0.unzonedRange.start,
-      footprint0.unzonedRange.end,
-      footprint1.unzonedRange.start,
-      footprint1.unzonedRange.end
-    ]
-
-    markers.sort(compareNumbers)
-
-    return new ComponentFootprint(
-      new UnzonedRange(markers[0], markers[3]),
-      footprint0.isAllDay
-    )
-  }
-
-
-  isSelectionFootprintAllowed(componentFootprint) {
-    return this.component.dateProfile.validUnzonedRange.containsRange(componentFootprint.unzonedRange) &&
-      this.view.calendar.constraints.isSelectionFootprintAllowed(componentFootprint)
-  }
-
-}

+ 0 - 332
src/component/interactions/EventDragging.ts

@@ -1,332 +0,0 @@
-import { enableCursor, disableCursor } from '../../util/misc'
-import EventDefMutation from '../../models/event/EventDefMutation'
-import EventDefDateMutation from '../../models/event/EventDefDateMutation'
-import DragListener from '../../common/DragListener'
-import HitDragListener from '../../common/HitDragListener'
-import MouseFollower from '../../common/MouseFollower'
-import Interaction from './Interaction'
-import { startOfDay } from '../../datelib/marker'
-
-
-export default class EventDragging extends Interaction {
-
-  eventPointing: any
-  dragListener: any
-  isDragging: boolean = false
-
-
-  /*
-  component implements:
-    - bindSegHandlerToEl
-    - publiclyTrigger
-    - diffDates
-    - eventRangesToEventFootprints
-    - isEventInstanceGroupAllowed
-  */
-  constructor(component, eventPointing) {
-    super(component)
-    this.eventPointing = eventPointing
-  }
-
-
-  end() {
-    if (this.dragListener) {
-      this.dragListener.endInteraction()
-    }
-  }
-
-
-  getSelectionDelay() {
-    let delay = this.opt('eventLongPressDelay')
-
-    if (delay == null) {
-      delay = this.opt('longPressDelay') // fallback
-    }
-
-    return delay
-  }
-
-
-  bindToEl(el) {
-    let component = this.component
-
-    component.bindSegHandlerToEl(el, 'mousedown', this.handleMousedown.bind(this))
-    component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this))
-  }
-
-
-  handleMousedown(seg, ev) {
-    if (
-      !this.component.shouldIgnoreMouse() &&
-      this.component.canStartDrag(seg, ev)
-    ) {
-      this.buildDragListener(seg).startInteraction(ev, { distance: 5 })
-    }
-  }
-
-
-  handleTouchStart(seg, ev) {
-    let component = this.component
-    let settings = {
-      delay: this.view.isEventDefSelected(seg.footprint.eventDef) ? // already selected?
-        0 : this.getSelectionDelay()
-    }
-
-    if (component.canStartDrag(seg, ev)) {
-      this.buildDragListener(seg).startInteraction(ev, settings)
-    } else if (component.canStartSelection(seg, ev)) {
-      this.buildSelectListener(seg).startInteraction(ev, settings)
-    }
-  }
-
-
-  // seg isn't draggable, but let's use a generic DragListener
-  // simply for the delay, so it can be selected.
-  // Has side effect of setting/unsetting `dragListener`
-  buildSelectListener(seg) {
-    let view = this.view
-    let eventDef = seg.footprint.eventDef
-    let eventInstance = seg.footprint.eventInstance // null for inverse-background events
-
-    if (this.dragListener) {
-      return this.dragListener
-    }
-
-    let dragListener = this.dragListener = new DragListener({
-      dragStart: (ev) => {
-        if (
-          dragListener.isTouch &&
-          !view.isEventDefSelected(eventDef) &&
-          eventInstance
-        ) {
-          // if not previously selected, will fire after a delay. then, select the event
-          view.selectEventInstance(eventInstance)
-        }
-      },
-      interactionEnd: (ev) => {
-        this.dragListener = null
-      }
-    })
-
-    return dragListener
-  }
-
-
-  // Builds a listener that will track user-dragging on an event segment.
-  // Generic enough to work with any type of Grid.
-  // Has side effect of setting/unsetting `dragListener`
-  buildDragListener(seg) {
-    let component = this.component
-    let view = this.view
-    let calendar = view.calendar
-    let eventManager = calendar.eventManager
-    let el = seg.el
-    let eventDef = seg.footprint.eventDef
-    let eventInstance = seg.footprint.eventInstance // null for inverse-background events
-    let isDragging
-    let mouseFollower // A clone of the original element that will move with the mouse
-    let eventDefMutation
-
-    if (this.dragListener) {
-      return this.dragListener
-    }
-
-    // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents
-    // of the view.
-    let dragListener = this.dragListener = new HitDragListener(view, {
-      scroll: this.opt('dragScroll'),
-      subjectEl: el,
-      subjectCenter: true,
-      interactionStart: (ev) => {
-        seg.component = component // for renderDrag
-        isDragging = false
-        mouseFollower = new MouseFollower(seg.el, {
-          additionalClass: 'fc-dragging',
-          parentEl: view.el,
-          opacity: dragListener.isTouch ? null : this.opt('dragOpacity'),
-          revertDuration: this.opt('dragRevertDuration'),
-          zIndex: 2 // one above the .fc-view
-        })
-        mouseFollower.hide() // don't show until we know this is a real drag
-        mouseFollower.start(ev)
-      },
-      dragStart: (ev) => {
-        if (
-          dragListener.isTouch &&
-          !view.isEventDefSelected(eventDef) &&
-          eventInstance
-        ) {
-          // if not previously selected, will fire after a delay. then, select the event
-          view.selectEventInstance(eventInstance)
-        }
-        isDragging = true
-
-        // ensure a mouseout on the manipulated event has been reported
-        this.eventPointing.handleMouseout(seg, ev)
-
-        this.segDragStart(seg, ev)
-        view.hideEventsWithId(seg.footprint.eventDef.id)
-      },
-      hitOver: (hit, isOrig, origHit) => {
-        let isAllowed = true
-        let origFootprint
-        let footprint
-        let mutatedEventInstanceGroup
-
-        // starting hit could be forced (DayGrid.limit)
-        if (seg.hit) {
-          origHit = seg.hit
-        }
-
-        // hit might not belong to this grid, so query origin grid
-        origFootprint = origHit.component.getSafeHitFootprint(origHit)
-        footprint = hit.component.getSafeHitFootprint(hit)
-
-        if (origFootprint && footprint) {
-          eventDefMutation = this.computeEventDropMutation(origFootprint, footprint, eventDef)
-
-          if (eventDefMutation) {
-            mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(
-              eventDef.id,
-              eventDefMutation
-            )
-            isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup)
-          } else {
-            isAllowed = false
-          }
-        } else {
-          isAllowed = false
-        }
-
-        if (!isAllowed) {
-          eventDefMutation = null
-          disableCursor()
-        }
-
-        // if a valid drop location, have the subclass render a visual indication
-        if (
-          eventDefMutation &&
-          view.renderDrag( // truthy if rendered something
-            component.eventRangesToEventFootprints(
-              mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)
-            ),
-            seg,
-            dragListener.isTouch
-          )
-        ) {
-          mouseFollower.hide() // if the subclass is already using a mock event "helper", hide our own
-        } else {
-          mouseFollower.show() // otherwise, have the helper follow the mouse (no snapping)
-        }
-
-        if (isOrig) {
-          // needs to have moved hits to be a valid drop
-          eventDefMutation = null
-        }
-      },
-      hitOut: () => { // called before mouse moves to a different hit OR moved out of all hits
-        view.unrenderDrag(seg) // unrender whatever was done in renderDrag
-        mouseFollower.show() // show in case we are moving out of all hits
-        eventDefMutation = null
-      },
-      hitDone: () => { // Called after a hitOut OR before a dragEnd
-        enableCursor()
-      },
-      interactionEnd: (ev) => {
-        delete seg.component // prevent side effects
-
-        // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
-        mouseFollower.stop(!eventDefMutation, () => {
-          if (isDragging) {
-            view.unrenderDrag(seg)
-            this.segDragStop(seg, ev)
-          }
-
-          view.showEventsWithId(seg.footprint.eventDef.id)
-
-          if (eventDefMutation) {
-            // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
-            view.reportEventDrop(eventInstance, eventDefMutation, el, ev)
-          }
-        })
-
-        this.dragListener = null
-      }
-    })
-
-    return dragListener
-  }
-
-
-  // Called before event segment dragging starts
-  segDragStart(seg, ev) {
-    this.isDragging = true
-    this.component.publiclyTrigger('eventDragStart', [
-      {
-        el: seg.el,
-        event: seg.footprint.getEventLegacy(this.component._getCalendar()),
-        jsEvent: ev,
-        view: this.view
-      }
-    ])
-  }
-
-
-  // Called after event segment dragging stops
-  segDragStop(seg, ev) {
-    this.isDragging = false
-    this.component.publiclyTrigger('eventDragStop', [
-      {
-        el: seg.el,
-        event: seg.footprint.getEventLegacy(this.component._getCalendar()),
-        jsEvent: ev,
-        view: this.view
-      }
-    ])
-  }
-
-
-  // DOES NOT consider overlap/constraint
-  computeEventDropMutation(startFootprint, endFootprint, eventDef) {
-    let eventDefMutation = new EventDefMutation()
-
-    eventDefMutation.setDateMutation(
-      this.computeEventDateMutation(startFootprint, endFootprint)
-    )
-
-    return eventDefMutation
-  }
-
-
-  computeEventDateMutation(startFootprint, endFootprint) {
-    let date0 = startFootprint.unzonedRange.start
-    let date1 = endFootprint.unzonedRange.start
-    let clearEnd = false
-    let forceTimed = false
-    let forceAllDay = false
-    let dateDelta
-    let dateMutation
-
-    if (startFootprint.isAllDay !== endFootprint.isAllDay) {
-      clearEnd = true
-
-      if (endFootprint.isAllDay) {
-        forceAllDay = true
-        date0 = startOfDay(date0)
-      } else {
-        forceTimed = true
-      }
-    }
-
-    dateDelta = this.component.diffDates(date0, date1)
-
-    dateMutation = new EventDefDateMutation()
-    dateMutation.clearEnd = clearEnd
-    dateMutation.forceTimed = forceTimed
-    dateMutation.forceAllDay = forceAllDay
-    dateMutation.setDateDelta(dateDelta)
-
-    return dateMutation
-  }
-
-}

+ 0 - 99
src/component/interactions/EventPointing.ts

@@ -1,99 +0,0 @@
-import GlobalEmitter from '../../common/GlobalEmitter'
-import Interaction from './Interaction'
-
-
-export default class EventPointing extends Interaction {
-
-  mousedOverSeg: any // the segment object the user's mouse is over. null if over nothing
-
-
-  /*
-  component must implement:
-    - publiclyTrigger
-  */
-
-
-  bindToEl(el) {
-    let component = this.component
-
-    component.bindSegHandlerToEl(el, 'click', this.handleClick.bind(this))
-
-    component.bindSegHoverHandlersToEl(
-      el,
-      this.handleMouseover.bind(this),
-      this.handleMouseout.bind(this)
-    )
-  }
-
-
-  handleClick(seg, ev) {
-    let res = this.component.publiclyTrigger('eventClick', [ // can return `false` to cancel
-      {
-        el: seg.el,
-        event: seg.footprint.getEventLegacy(this.view.calendar),
-        jsEvent: ev,
-        view: this.view
-      }
-    ])
-
-    if (res === false) {
-      ev.preventDefault()
-    }
-  }
-
-
-  // Updates internal state and triggers handlers for when an event element is moused over
-  handleMouseover(seg, ev) {
-    if (
-      !GlobalEmitter.get().shouldIgnoreMouse() &&
-      !this.mousedOverSeg
-    ) {
-      this.mousedOverSeg = seg
-
-      // TODO: move to EventSelecting's responsibility
-      if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
-        seg.el.classList.add('fc-allow-mouse-resize')
-      }
-
-      this.component.publiclyTrigger('eventMouseover', [
-        {
-          el: seg.el,
-          event: seg.footprint.getEventLegacy(this.view.calendar),
-          jsEvent: ev,
-          view: this.view
-        }
-      ])
-    }
-  }
-
-
-  // Updates internal state and triggers handlers for when an event element is moused out.
-  // Can be given no arguments, in which case it will mouseout the segment that was previously moused over.
-  handleMouseout(seg, ev?) {
-    if (this.mousedOverSeg) {
-      this.mousedOverSeg = null
-
-      // TODO: move to EventSelecting's responsibility
-      if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
-        seg.el.classList.remove('fc-allow-mouse-resize')
-      }
-
-      this.component.publiclyTrigger('eventMouseout', [
-        {
-          el: seg.el,
-          event: seg.footprint.getEventLegacy(this.view.calendar),
-          jsEvent: ev || {}, // if given no arg, make a mock mouse event
-          view: this.view
-        }
-      ])
-    }
-  }
-
-
-  end() {
-    if (this.mousedOverSeg) {
-      this.handleMouseout(this.mousedOverSeg)
-    }
-  }
-
-}

+ 0 - 238
src/component/interactions/EventResizing.ts

@@ -1,238 +0,0 @@
-import { disableCursor, enableCursor } from '../../util/misc'
-import EventDefMutation from '../../models/event/EventDefMutation'
-import EventDefDateMutation from '../../models/event/EventDefDateMutation'
-import HitDragListener from '../../common/HitDragListener'
-import Interaction from './Interaction'
-
-
-export default class EventResizing extends Interaction {
-
-  eventPointing: any
-  dragListener: any
-  isResizing: boolean = false
-
-
-  /*
-  component impements:
-    - bindSegHandlerToEl
-    - publiclyTrigger
-    - diffDates
-    - eventRangesToEventFootprints
-    - isEventInstanceGroupAllowed
-    - getSafeHitFootprint
-  */
-
-
-  constructor(component, eventPointing) {
-    super(component)
-    this.eventPointing = eventPointing
-  }
-
-
-  end() {
-    if (this.dragListener) {
-      this.dragListener.endInteraction()
-    }
-  }
-
-
-  bindToEl(el) {
-    let component = this.component
-
-    component.bindSegHandlerToEl(el, 'mousedown', this.handleMouseDown.bind(this))
-    component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this))
-  }
-
-
-  handleMouseDown(seg, ev) {
-    if (this.component.canStartResize(seg, ev)) {
-      this.buildDragListener(seg, ev.target.classList.contains('fc-start-resizer'))
-        .startInteraction(ev, { distance: 5 })
-    }
-  }
-
-
-  handleTouchStart(seg, ev) {
-    if (this.component.canStartResize(seg, ev)) {
-      this.buildDragListener(seg, ev.target.classList.contains('fc-start-resizer'))
-        .startInteraction(ev)
-    }
-  }
-
-
-  // Creates a listener that tracks the user as they resize an event segment.
-  // Generic enough to work with any type of Grid.
-  buildDragListener(seg, isStart) {
-    let component = this.component
-    let view = this.view
-    let calendar = view.calendar
-    let eventManager = calendar.eventManager
-    let el = seg.el
-    let eventDef = seg.footprint.eventDef
-    let eventInstance = seg.footprint.eventInstance
-    let isDragging
-    let resizeMutation // zoned event date properties. falsy if invalid resize
-
-    // Tracks mouse movement over the *grid's* coordinate map
-    let dragListener = this.dragListener = new HitDragListener(component, {
-      scroll: this.opt('dragScroll'),
-      subjectEl: el,
-      interactionStart: () => {
-        isDragging = false
-      },
-      dragStart: (ev) => {
-        isDragging = true
-
-        // ensure a mouseout on the manipulated event has been reported
-        this.eventPointing.handleMouseout(seg, ev)
-
-        this.segResizeStart(seg, ev)
-      },
-      hitOver: (hit, isOrig, origHit) => {
-        let isAllowed = true
-        let origHitFootprint = component.getSafeHitFootprint(origHit)
-        let hitFootprint = component.getSafeHitFootprint(hit)
-        let mutatedEventInstanceGroup
-
-        if (origHitFootprint && hitFootprint) {
-          resizeMutation = isStart ?
-            this.computeEventStartResizeMutation(origHitFootprint, hitFootprint, seg.footprint) :
-            this.computeEventEndResizeMutation(origHitFootprint, hitFootprint, seg.footprint)
-
-          if (resizeMutation) {
-            mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(
-              eventDef.id,
-              resizeMutation
-            )
-            isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup)
-          } else {
-            isAllowed = false
-          }
-        } else {
-          isAllowed = false
-        }
-
-        if (!isAllowed) {
-          resizeMutation = null
-          disableCursor()
-        } else if (resizeMutation.isEmpty()) {
-          // no change. (FYI, event dates might have zones)
-          resizeMutation = null
-        }
-
-        if (resizeMutation) {
-          view.hideEventsWithId(seg.footprint.eventDef.id)
-          view.renderEventResize(
-            component.eventRangesToEventFootprints(
-              mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)
-            ),
-            seg
-          )
-        }
-      },
-      hitOut: () => { // called before mouse moves to a different hit OR moved out of all hits
-        resizeMutation = null
-      },
-      hitDone: () => { // resets the rendering to show the original event
-        view.unrenderEventResize(seg)
-        view.showEventsWithId(seg.footprint.eventDef.id)
-        enableCursor()
-      },
-      interactionEnd: (ev) => {
-        if (isDragging) {
-          this.segResizeStop(seg, ev)
-        }
-
-        if (resizeMutation) { // valid date to resize to?
-          // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
-          view.reportEventResize(eventInstance, resizeMutation, el, ev)
-        }
-
-        this.dragListener = null
-      }
-    })
-
-    return dragListener
-  }
-
-
-  // Called before event segment resizing starts
-  segResizeStart(seg, ev) {
-    this.isResizing = true
-    this.component.publiclyTrigger('eventResizeStart', [
-      {
-        el: seg.el,
-        event: seg.footprint.getEventLegacy(this.view.calendar),
-        jsEvent: ev,
-        view: this.view
-      }
-    ])
-  }
-
-
-  // Called after event segment resizing stops
-  segResizeStop(seg, ev) {
-    this.isResizing = false
-    this.component.publiclyTrigger('eventResizeStop', [
-      {
-        el: seg.el,
-        event: seg.footprint.getEventLegacy(this.view.calendar),
-        jsEvent: ev,
-        view: this.view
-      }
-    ])
-  }
-
-
-  // Returns new date-information for an event segment being resized from its start
-  computeEventStartResizeMutation(startFootprint, endFootprint, origEventFootprint) {
-    const dateEnv = this.component._getCalendar().dateEnv
-    let origRange = origEventFootprint.componentFootprint.unzonedRange
-    let startDelta = this.component.diffDates(
-      startFootprint.unzonedRange.start,
-      endFootprint.unzonedRange.start
-    )
-    let dateMutation
-    let eventDefMutation
-
-    if (dateEnv.add(origRange.start, startDelta) < origRange.end) {
-
-      dateMutation = new EventDefDateMutation()
-      dateMutation.setStartDelta(startDelta)
-
-      eventDefMutation = new EventDefMutation()
-      eventDefMutation.setDateMutation(dateMutation)
-
-      return eventDefMutation
-    }
-
-    return false
-  }
-
-
-  // Returns new date-information for an event segment being resized from its end
-  computeEventEndResizeMutation(startFootprint, endFootprint, origEventFootprint) {
-    const dateEnv = this.component._getCalendar().dateEnv
-    let origRange = origEventFootprint.componentFootprint.unzonedRange
-    let endDelta = this.component.diffDates(
-      startFootprint.unzonedRange.end,
-      endFootprint.unzonedRange.end
-    )
-    let dateMutation
-    let eventDefMutation
-
-    if (dateEnv.add(origRange.end, endDelta) > origRange.start) {
-
-      dateMutation = new EventDefDateMutation()
-      dateMutation.setEndDelta(endDelta)
-
-      eventDefMutation = new EventDefMutation()
-      eventDefMutation.setDateMutation(dateMutation)
-
-      return eventDefMutation
-    }
-
-    return false
-  }
-
-}

+ 0 - 237
src/component/interactions/ExternalDropping.ts

@@ -1,237 +0,0 @@
-import { assignTo } from '../../util/object'
-import { elementMatches } from '../../util/dom-manip'
-import { disableCursor, enableCursor } from '../../util/misc'
-import HitDragListener from '../../common/HitDragListener'
-import SingleEventDef from '../../models/event/SingleEventDef'
-import EventInstanceGroup from '../../models/event/EventInstanceGroup'
-import EventSource from '../../models/event-source/EventSource'
-import Interaction from './Interaction'
-import { startOfDay } from '../../datelib/marker'
-import { createDuration } from '../../datelib/duration'
-
-
-export default class ExternalDropping extends Interaction {
-
-  static dataAttrPrefix: string = ''
-
-  dragListener: any
-  isDragging: boolean = false // jqui-dragging an external element? boolean
-
-
-  // Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure
-  // to be used for Event Object creation.
-  // A defined `.eventProps`, even when empty, indicates that an event should be created.
-  static getDraggedElMeta(el) {
-    let eventProps // properties for creating the event, not related to date/time
-    let startTime // a Duration
-    let duration
-    let stick
-
-    eventProps = ExternalDropping.getEmbeddedElData(el, 'event', true)
-
-    if (eventProps) {
-
-      // something like 1 or true. still signal event creation
-      if (typeof eventProps !== 'object') {
-        eventProps = {}
-      }
-
-      // pluck special-cased date/time properties
-      startTime = eventProps.start
-      if (startTime == null) { startTime = eventProps.time } // accept 'time' as well
-      duration = eventProps.duration
-      stick = eventProps.stick
-      delete eventProps.start
-      delete eventProps.time
-      delete eventProps.duration
-      delete eventProps.stick
-    }
-
-    // fallback to standalone attribute values for each of the date/time properties
-    if (startTime == null) { startTime = ExternalDropping.getEmbeddedElData(el, 'start') }
-    if (startTime == null) { startTime = ExternalDropping.getEmbeddedElData(el, 'time') } // accept 'time' as well
-    if (duration == null) { duration = ExternalDropping.getEmbeddedElData(el, 'duration') }
-    if (stick == null) { stick = ExternalDropping.getEmbeddedElData(el, 'stick', true) }
-
-    // massage into correct data types
-    startTime = startTime != null ? createDuration(startTime) : null
-    duration = duration != null ? createDuration(duration) : null
-    stick = Boolean(stick)
-
-    return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick }
-  }
-
-  static getEmbeddedElData(el, name, shouldParseJson = false) {
-    let prefix = ExternalDropping.dataAttrPrefix
-    let prefixedName = (prefix ? prefix + '-' : '') + name
-
-    let data = el.getAttribute('data-' + prefixedName) || null
-    if (data && shouldParseJson) {
-      data = JSON.parse(data)
-    }
-
-    return data
-  }
-
-
-  /*
-  component impements:
-    - eventRangesToEventFootprints
-    - isEventInstanceGroupAllowed
-    - isExternalInstanceGroupAllowed
-    - renderDrag
-    - unrenderDrag
-  */
-
-
-  end() {
-    if (this.dragListener) {
-      this.dragListener.endInteraction()
-    }
-  }
-
-
-  // Called when a jQuery UI drag is initiated anywhere in the DOM
-  handleDragStart(ev, el, skipBinding) {
-    let accept
-
-    if (this.opt('droppable')) { // only listen if this setting is on
-
-      // Test that the dragged element passes the dropAccept selector or filter function.
-      // FYI, the default is "*" (matches all)
-      accept = this.opt('dropAccept')
-      if (typeof accept === 'function' ? accept.call(el, el) : elementMatches(el, accept)) {
-        if (!this.isDragging) { // prevent double-listening if fired twice
-          this.listenToExternalDrag(ev, el, skipBinding)
-        }
-      }
-    }
-  }
-
-
-  handleDragMove(ev) {
-    if (this.dragListener) {
-      this.dragListener.handleMove(ev)
-    }
-  }
-
-
-  handleDragStop(ev) {
-    if (this.dragListener) {
-      this.dragListener.endInteraction(ev)
-    }
-  }
-
-
-  // Called when a 3rd-party draggable starts and it needs to be monitored for dropping
-  listenToExternalDrag(ev, el, skipBinding) {
-    let component = this.component
-    let view = this.view
-    let meta = ExternalDropping.getDraggedElMeta(el) // extra data about event drop, including possible event to create
-    let singleEventDef // a null value signals an unsuccessful drag
-
-    // listener that tracks mouse movement over date-associated pixel regions
-    let dragListener = this.dragListener = new HitDragListener(component, {
-      interactionStart: () => {
-        this.isDragging = true
-      },
-      hitOver: (hit) => {
-        let isAllowed = true
-        let hitFootprint = hit.component.getSafeHitFootprint(hit) // hit might not belong to this grid
-        let mutatedEventInstanceGroup
-
-        if (hitFootprint) {
-          singleEventDef = this.computeExternalDrop(hitFootprint, meta)
-
-          if (singleEventDef) {
-            mutatedEventInstanceGroup = new EventInstanceGroup(
-              singleEventDef.buildInstances()
-            )
-            isAllowed = meta.eventProps ? // isEvent?
-              component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup) :
-              component.isExternalInstanceGroupAllowed(mutatedEventInstanceGroup)
-          } else {
-            isAllowed = false
-          }
-        } else {
-          isAllowed = false
-        }
-
-        if (!isAllowed) {
-          singleEventDef = null
-          disableCursor()
-        }
-
-        if (singleEventDef) {
-          component.renderDrag( // called without a seg parameter
-            component.eventRangesToEventFootprints(
-              mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, view.calendar)
-            )
-          )
-        }
-      },
-      hitOut: () => {
-        singleEventDef = null // signal unsuccessful
-      },
-      hitDone: () => { // Called after a hitOut OR before a dragEnd
-        enableCursor()
-        component.unrenderDrag()
-      },
-      interactionEnd: (ev) => {
-
-        if (singleEventDef) { // element was dropped on a valid hit
-          view.reportExternalDrop(
-            singleEventDef,
-            Boolean(meta.eventProps), // isEvent
-            Boolean(meta.stick), // isSticky
-            el, ev
-          )
-        }
-
-        this.isDragging = false
-        this.dragListener = null
-      }
-    })
-
-    dragListener.skipBinding = skipBinding
-    dragListener.startDrag(ev) // start listening immediately
-  }
-
-
-  // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object),
-  // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null.
-  // Returning a null value signals an invalid drop hit.
-  // DOES NOT consider overlap/constraint.
-  // Assumes both footprints are non-open-ended.
-  computeExternalDrop(componentFootprint, meta) {
-    let calendar = this.view.calendar
-    const dateEnv = calendar.dateEnv
-    let start = componentFootprint.unzonedRange.start
-    let end
-    let eventDef
-
-    if (componentFootprint.isAllDay) {
-      start = startOfDay(start)
-
-      // if dropped on an all-day span, and element's metadata specified a time, set it
-      if (meta.startTime) {
-        start = dateEnv.add(start, meta.startTime)
-      }
-    }
-
-    if (meta.duration) {
-      end = dateEnv.add(start, meta.duration)
-    }
-
-    eventDef = SingleEventDef.parse(
-      assignTo({}, meta.eventProps, {
-        start: dateEnv.toDate(start), // inefficient to convert back
-        end: end ? dateEnv.toDate(end) : null // inefficient to convert back
-      }),
-      new EventSource(calendar)
-    )
-
-    return eventDef
-  }
-
-}

+ 0 - 24
src/component/interactions/Interaction.ts

@@ -1,24 +0,0 @@
-import InteractiveDateComponent from '../InteractiveDateComponent'
-
-export default class Interaction {
-
-  view: any
-  component: InteractiveDateComponent
-
-
-  constructor(component) {
-    this.view = component._getView()
-    this.component = component
-  }
-
-
-  opt(name) {
-    return this.view.opt(name)
-  }
-
-
-  end() {
-    // subclasses can implement
-  }
-
-}

+ 0 - 17
src/component/interactions/StandardInteractionsMixin.ts

@@ -1,17 +0,0 @@
-import Mixin from '../../common/Mixin'
-import DateClicking from './DateClicking'
-import DateSelecting from './DateSelecting'
-import EventPointing from './EventPointing'
-import EventDragging from './EventDragging'
-import EventResizing from './EventResizing'
-import ExternalDropping from './ExternalDropping'
-
-export default class StandardInteractionsMixin extends Mixin {
-}
-
-(StandardInteractionsMixin as any).prototype.dateClickingClass = DateClicking;
-(StandardInteractionsMixin as any).prototype.dateSelectingClass = DateSelecting;
-(StandardInteractionsMixin as any).prototype.eventPointingClass = EventPointing;
-(StandardInteractionsMixin as any).prototype.eventDraggingClass = EventDragging;
-(StandardInteractionsMixin as any).prototype.eventResizingClass = EventResizing;
-(StandardInteractionsMixin as any).prototype.externalDroppingClass = ExternalDropping

+ 0 - 17
src/exports.ts

@@ -74,20 +74,9 @@ export {
 export { default as EmitterMixin, EmitterInterface } from './common/EmitterMixin'
 export { default as ListenerMixin, ListenerInterface } from './common/ListenerMixin'
 export { default as Model } from './common/Model'
-export { default as Constraints } from './Constraints'
 export { default as UnzonedRange } from './models/UnzonedRange'
-export { default as ComponentFootprint } from './models/ComponentFootprint'
 export { default as BusinessHourGenerator } from './models/BusinessHourGenerator'
-export { default as EventDef } from './models/event/EventDef'
-export { default as EventDefMutation } from './models/event/EventDefMutation'
-export { default as EventSourceParser } from './models/event-source/EventSourceParser'
-export { default as EventSource } from './models/event-source/EventSource'
 export { defineThemeSystem } from './theme/ThemeRegistry'
-export { default as EventInstanceGroup } from './models/event/EventInstanceGroup'
-export { default as ArrayEventSource } from './models/event-source/ArrayEventSource'
-export { default as FuncEventSource } from './models/event-source/FuncEventSource'
-export { default as JsonFeedEventSource } from './models/event-source/JsonFeedEventSource'
-export { default as EventFootprint } from './models/event/EventFootprint'
 export { default as Class } from './common/Class'
 export { default as Mixin } from './common/Mixin'
 export { default as CoordCache } from './common/CoordCache'
@@ -106,12 +95,6 @@ export { default as BusinessHourRenderer } from './component/renderers/BusinessH
 export { default as EventRenderer } from './component/renderers/EventRenderer'
 export { default as FillRenderer } from './component/renderers/FillRenderer'
 export { default as HelperRenderer } from './component/renderers/HelperRenderer'
-export { default as ExternalDropping } from './component/interactions/ExternalDropping'
-export { default as EventResizing } from './component/interactions/EventResizing'
-export { default as EventPointing } from './component/interactions/EventPointing'
-export { default as EventDragging } from './component/interactions/EventDragging'
-export { default as DateSelecting } from './component/interactions/DateSelecting'
-export { default as StandardInteractionsMixin } from './component/interactions/StandardInteractionsMixin'
 export { default as AgendaView } from './agenda/AgendaView'
 export { default as TimeGrid } from './agenda/TimeGrid'
 export { default as DayGrid } from './basic/DayGrid'

+ 0 - 24
src/list/ListEventPointing.ts

@@ -1,24 +0,0 @@
-import { elementClosest } from '../util/dom-manip'
-import EventPointing from '../component/interactions/EventPointing'
-
-
-export default class ListEventPointing extends EventPointing {
-
-  // for events with a url, the whole <tr> should be clickable,
-  // but it's impossible to wrap with an <a> tag. simulate this.
-  handleClick(seg, ev) {
-    let url
-
-    super.handleClick(seg, ev) // might prevent the default action
-
-    // not clicking on or within an <a> with an href
-    if (!elementClosest(ev.target, 'a[href]')) {
-      url = seg.footprint.eventDef.url
-
-      if (url && !ev.isDefaultPrevented()) { // jsEvent not cancelled in handler
-        window.location.href = url // simulate link click
-      }
-    }
-  }
-
-}

+ 23 - 0
src/list/ListView.ts

@@ -236,3 +236,26 @@ export default class ListView extends View {
 
 ListView.prototype.eventRendererClass = ListEventRenderer
 ListView.prototype.eventPointingClass = ListEventPointing
+
+/*
+export default class ListEventPointing extends EventPointing {
+
+  // for events with a url, the whole <tr> should be clickable,
+  // but it's impossible to wrap with an <a> tag. simulate this.
+  handleClick(seg, ev) {
+    let url
+
+    super.handleClick(seg, ev) // might prevent the default action
+
+    // not clicking on or within an <a> with an href
+    if (!elementClosest(ev.target, 'a[href]')) {
+      url = seg.footprint.eventDef.url
+
+      if (url && !ev.isDefaultPrevented()) { // jsEvent not cancelled in handler
+        window.location.href = url // simulate link click
+      }
+    }
+  }
+
+}
+*/

+ 0 - 27
src/models/ComponentFootprint.ts

@@ -1,27 +0,0 @@
-
-/*
-Meant to be immutable
-*/
-export default class ComponentFootprint {
-
-  unzonedRange: any
-  isAllDay: boolean = false // component can choose to ignore this
-
-
-  constructor(unzonedRange, isAllDay) {
-    this.unzonedRange = unzonedRange
-    this.isAllDay = isAllDay
-  }
-
-
-  /*
-  Only works for non-open-ended ranges.
-  */
-  toLegacy(calendar) {
-    return {
-      start: calendar.dateEnv.toDate(this.unzonedRange.start),
-      end: calendar.dateEnv.toDate(this.unzonedRange.end)
-    }
-  }
-
-}

+ 1 - 1
src/models/UnzonedRange.ts

@@ -5,7 +5,7 @@ export default class UnzonedRange {
   start: DateMarker // if null, no start constraint
   end: DateMarker // if null, no end constraint
 
-  // TODO: move these into footprint.
+  // TODO: move these into some other objects.
   // Especially, doesn't make sense for null start/end
   isStart: boolean = true
   isEnd: boolean = true

+ 0 - 23
src/models/event/EventFootprint.ts

@@ -1,23 +0,0 @@
-
-export default class EventFootprint {
-
-  componentFootprint: any
-  eventDef: any
-  eventInstance: any // optional
-
-
-  constructor(componentFootprint, eventDef, eventInstance) {
-    this.componentFootprint = componentFootprint
-    this.eventDef = eventDef
-
-    if (eventInstance) {
-      this.eventInstance = eventInstance
-    }
-  }
-
-
-  getEventLegacy(calendar) {
-    return (this.eventInstance || this.eventDef).toLegacy(calendar)
-  }
-
-}

+ 0 - 48
src/models/event/util.ts

@@ -1,48 +0,0 @@
-import EventRange from './EventRange'
-import EventFootprint from './EventFootprint'
-import ComponentFootprint from '../ComponentFootprint'
-
-
-export function eventDefsToEventInstances(eventDefs, unzonedRange) {
-  let eventInstances = []
-  let i
-
-  for (i = 0; i < eventDefs.length; i++) {
-    eventInstances.push.apply(eventInstances, // append
-      eventDefs[i].buildInstances(unzonedRange)
-    )
-  }
-
-  return eventInstances
-}
-
-
-export function eventInstanceToEventRange(eventInstance) {
-  return new EventRange(
-    eventInstance.dateProfile.unzonedRange,
-    eventInstance.def,
-    eventInstance
-  )
-}
-
-
-export function eventRangeToEventFootprint(eventRange) {
-  return new EventFootprint(
-    new ComponentFootprint(
-      eventRange.unzonedRange,
-      eventRange.eventDef.isAllDay()
-    ),
-    eventRange.eventDef,
-    eventRange.eventInstance // might not exist
-  )
-}
-
-
-export function eventInstanceToUnzonedRange(eventInstance) {
-  return eventInstance.dateProfile.unzonedRange
-}
-
-
-export function eventFootprintToComponentFootprint(eventFootprint) {
-  return eventFootprint.componentFootprint
-}

+ 7 - 7
tests/automated/performance/rerenders.js

@@ -40,7 +40,7 @@ describe('rerender performance', function() {
 
         it('calls methods a limited number of times', function(done) {
           var executeDateRender = spyOnMethod(Class, 'executeDateRender')
-          var executeEventRender = spyOnMethod(Class, 'executeEventRender')
+          var renderEventRanges = spyOnMethod(Class, 'renderEventRanges')
           var updateSize = spyOnMethod(Class, 'updateSize')
 
           initCalendar({
@@ -48,25 +48,25 @@ describe('rerender performance', function() {
           })
 
           expect(executeDateRender.calls.count()).toBe(1)
-          expect(executeEventRender.calls.count()).toBe(1)
+          expect(renderEventRanges.calls.count()).toBe(1)
           expect(updateSize.calls.count()).toBe(1)
 
           currentCalendar.changeView(settings.changeToView)
 
           expect(executeDateRender.calls.count()).toBe(1)
-          expect(executeEventRender.calls.count()).toBe(1)
+          expect(renderEventRanges.calls.count()).toBe(1)
           expect(updateSize.calls.count()).toBe(2) // +1
 
           currentCalendar.changeView(settings.defaultView)
 
           expect(executeDateRender.calls.count()).toBe(2) // +1
-          expect(executeEventRender.calls.count()).toBe(2) // +1
+          expect(renderEventRanges.calls.count()).toBe(2) // +1
           expect(updateSize.calls.count()).toBe(3) // +1
 
           currentCalendar.rerenderEvents()
 
           expect(executeDateRender.calls.count()).toBe(2)
-          expect(executeEventRender.calls.count()).toBe(3) // +1
+          expect(renderEventRanges.calls.count()).toBe(3) // +1
           expect(updateSize.calls.count()).toBe(5) // +2, TODO: get to just +1
 
           $(window).simulate('resize')
@@ -74,11 +74,11 @@ describe('rerender performance', function() {
           setTimeout(function() {
 
             expect(executeDateRender.calls.count()).toBe(2)
-            expect(executeEventRender.calls.count()).toBe(3)
+            expect(renderEventRanges.calls.count()).toBe(3)
             expect(updateSize.calls.count()).toBe(6) // +1
 
             executeDateRender.restore()
-            executeEventRender.restore()
+            renderEventRanges.restore()
             updateSize.restore()
 
             done()