Sha256: 07c7faf59e51935b492f91b9d83e96f19872dfc596dfbb093ebd622586286d4d
Contents?: true
Size: 1.6 KB
Versions: 31
Compression:
Stored size: 1.6 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 not be considered "inside" the view anymore. By default, up to 50px on each side. */ touchBoundary: { left: 50, right: 50, top: 50, bottom: 50 }, /** @private A computed property based on frame. */ _touchBoundaryFrame: function (){ return this.get("parentView").convertFrameToView(this.get('frame'), null); }.property("frame", "parentView").cacheable(), /** Returns YES if the provided touch is within the boundary. */ touchIsInBoundary: function(touch) { var f = this.get("_touchBoundaryFrame"), maxX = 0, maxY = 0, boundary = this.get("touchBoundary"); var x = touch.pageX, y = touch.pageY; if (x < f.x) { x = f.x - x; maxX = boundary.left; } else if (x > f.x + f.width) { x = x - (f.x + f.width); maxX = boundary.right; } else { x = 0; maxX = 1; } if (y < f.y) { y = f.y - y; maxY = boundary.top; } else if (y > f.y + f.height) { y = y - (f.y + f.height); maxY = boundary.bottom; } else { y = 0; maxY = 1; } if (x > 100 || y > 100) return NO; return YES; } });
Version data entries
31 entries across 31 versions & 2 rubygems