Sha256: 3f949601398b377fca9bded81d382f5e9e2852e81912dd8d7ed8df65070a9315

Contents?: true

Size: 1.88 KB

Versions: 14

Compression:

Stored size: 1.88 KB

Contents

sc_require("views/view");

SC.View.reopen(
  /** @scope SC.View.prototype */ {

  // ..........................................................
  // MULTITOUCH SUPPORT
  //
  /**
    Set to YES if you want to receive touch events for each distinct touch
    (rather than only the first touch start and last touch end).
  */
  acceptsMultitouch: NO,

  /**
    Is YES if the view is currently being touched. NO otherwise.
  */
  hasTouch: NO,

  /**
    A boundary set of distances outside which the touch will no longer be
    considered "inside" the view anymore.  This is useful when we want to allow
    a bit of touch drag outside of the view before we consider that the User's
    finger has completely left the view.  For example, a User might touch down
    on a button, but because of the wide surface of a finger, the touch might
    slip outside of the button's frame as the person lifts up.  If the button
    uses touchIsInBoundary it can make it easier for the User to hit it.

    By default, up to 25px on each side.
  */
  touchBoundary: { left: 25, right: 25, top: 25, bottom: 25 },

  /** @private
    A computed property based on frame.
  */
  _touchBoundaryFrame: function () {
    var boundary = this.get("touchBoundary"),
      ret;

    // Determine the frame of the View in screen coordinates
    ret = this.get("parentView").convertFrameToView(this.get('frame'), null);

    // Expand the frame to the acceptable boundary.
    ret.x -= boundary.left;
    ret.y -= boundary.top;
    ret.width += boundary.left + boundary.right;
    ret.height += boundary.top + boundary.bottom;

    return ret;
  }.property('touchBoundary', 'clippingFrame').cacheable(),

  /**
    Returns YES if the provided touch is within the boundary set by
    touchBoundary.
  */
  touchIsInBoundary: function(touch) {
    return SC.pointInRect({x: touch.pageX, y: touch.pageY},
      this.get("_touchBoundaryFrame"));
  }
});

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js