Skip to content

Commit

Permalink
Emit all dragging events on the view too.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Oct 17, 2013
1 parent 25a47eb commit 5d463ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 8 additions & 3 deletions build/framer.js
@@ -1,7 +1,7 @@
// Framer 2.0-41-g1d8cf24 (c) 2013 Koen Bok // Framer 2.0-42-g25a47eb (c) 2013 Koen Bok
// https://github.com/koenbok/Framer // https://github.com/koenbok/Framer


window.FramerVersion = "2.0-41-g1d8cf24"; window.FramerVersion = "2.0-42-g25a47eb";




(function(){var require = function (file, cwd) { (function(){var require = function (file, cwd) {
Expand Down Expand Up @@ -4971,6 +4971,11 @@ require.define("/src/ui/draggable.coffee",function(require,module,exports,__dirn
return this.view.off(Events.TouchStart, this._touchStart); return this.view.off(Events.TouchStart, this._touchStart);
}; };


Draggable.prototype.emit = function(eventName, event) {
this.view.emit(eventName, event);
return Draggable.__super__.emit.call(this, eventName, event);
};

Draggable.prototype.calculateVelocity = function() { Draggable.prototype.calculateVelocity = function() {
var curr, prev, time, timeSinceLastMove, velocity; var curr, prev, time, timeSinceLastMove, velocity;
if (this._deltas.length < 2) { if (this._deltas.length < 2) {
Expand Down Expand Up @@ -5017,7 +5022,7 @@ require.define("/src/ui/draggable.coffee",function(require,module,exports,__dirn
this.view.x = this._start.x + correctedDelta.x - this._offset.x; this.view.x = this._start.x + correctedDelta.x - this._offset.x;
this.view.y = this._start.y + correctedDelta.y - this._offset.y; this.view.y = this._start.y + correctedDelta.y - this._offset.y;
this._deltas.push(correctedDelta); this._deltas.push(correctedDelta);
return this.view.emit(Events.DragMove, event); return this.emit(Events.DragMove, event);
}; };


Draggable.prototype._touchStart = function(event) { Draggable.prototype._touchStart = function(event) {
Expand Down
10 changes: 9 additions & 1 deletion src/ui/draggable.coffee
Expand Up @@ -26,6 +26,14 @@ class exports.Draggable extends EventEmitter
attach: -> @view.on Events.TouchStart, @_touchStart attach: -> @view.on Events.TouchStart, @_touchStart
remove: -> @view.off Events.TouchStart, @_touchStart remove: -> @view.off Events.TouchStart, @_touchStart


emit: (eventName, event) ->
# We override this to get all events both on the draggable
# and the encapsulated view.
@view.emit eventName, event

super eventName, event


calculateVelocity: -> calculateVelocity: ->


if @_deltas.length < 2 if @_deltas.length < 2
Expand Down Expand Up @@ -69,7 +77,7 @@ class exports.Draggable extends EventEmitter


@_deltas.push correctedDelta @_deltas.push correctedDelta


@view.emit Events.DragMove, event @emit Events.DragMove, event


_touchStart: (event) => _touchStart: (event) =>


Expand Down

0 comments on commit 5d463ce

Please sign in to comment.