Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timob 8038 Implemented proper event propogation. #1758

Merged
merged 2 commits into from
Mar 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion mobileweb/titanium/Ti/Locale.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(["require", "Ti/_/lang", "Ti/_/Evented"], function(require, lang, Evented) {

var locale = navigator.language.replace(/^([^\-\_]+)[\-\_](.+)?$/, function(o, l, c){ return l.toLowerCase() + (c && "-" + c.toUpperCase()); }),
var locale = lang.val(navigator.language,navigator.browserLanguage).replace(/^([^\-\_]+)[\-\_](.+)?$/, function(o, l, c){ return l.toLowerCase() + (c && "-" + c.toUpperCase()); }),
languageParts = locale.split("-"),
language = languageParts[0];
strings = {},
Expand Down
4 changes: 2 additions & 2 deletions mobileweb/titanium/Ti/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ define(
node._layout._doLayout(node, node._measuredWidth, node._measuredHeight, node.width === Ti.UI.SIZE, node.height === Ti.UI.SIZE);
}

console.debug("Layout " + self._layoutCount + ": " + self._elementLayoutCount +
" elements laid out in " + ((new Date().getTime() - startTime)) + "ms");
//console.debug("Layout " + self._layoutCount + ": " + self._elementLayoutCount +
// " elements laid out in " + ((new Date().getTime() - startTime)) + "ms");

self._layoutInProgress = false;
self._layoutTimer = null;
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/DoubleTap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
Math.abs(this._firstTapLocation.y - y) < this._driftThreshold) {
var result = {
x: x,
y: y
y: y,
source: this.getSourceNode(e,element)
};
if (!element._isGestureBlocked(this.name)) {
this.blocking.push("singletap");
Expand Down
20 changes: 20 additions & 0 deletions mobileweb/titanium/Ti/_/Gestures/GestureRecognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ define(["Ti/_/declare", "Ti/_/lang"], function(declare,lang) {
this.blocking = [];
},

getSourceNode: function(evt, node) {
var sourceWidgetId = evt.target.getAttribute("data-widget-id"),
nodeStack = [node],
currentNode,
i,
children;
while(nodeStack.length > 0) {
currentNode = nodeStack.pop();
if (currentNode._alive) {
if (currentNode.widgetId === sourceWidgetId) {
return currentNode;
}
children = currentNode.children;
for (i in children) {
nodeStack.push(children[i]);
}
}
}
},

processTouchStartEvent: function(e, element){
},
finalizeTouchStartEvent: function(){
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/LongPress.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
this.blocking.push("doubletap");
lang.hitch(element,element._handleTouchEvent("longpress",{
x: e.changedTouches[0].clientX,
y: e.changedTouches[0].clientY
y: e.changedTouches[0].clientY,
source: this.getSourceNode(e,element)
}));
}
}),this._timeThreshold);
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/Pinch.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
if (!element._isGestureBlocked(this.name)) {
lang.hitch(element,element._handleTouchEvent(this.name,{
scale: currentDistance / this._startDistance,
velocity: velocity
velocity: velocity,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/SingleTap.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
this._touchStartLocation = null;
var result = {
x: x,
y: y
y: y,
source: this.getSourceNode(e,element)
};
if (!element._isGestureBlocked(this.name)) {
lang.hitch(element,element._handleTouchEvent("click",result));
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/Swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
y: y,
direction: direction,
_distance: x - this._touchStartLocation.x,
_finishedSwiping: finishedSwiping
_finishedSwiping: finishedSwiping,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/TouchCancel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
for (var i = 0; i < e.changedTouches.length; i++) {
lang.hitch(element,element._handleTouchEvent(this.name,{
x: e.changedTouches[i].clientX,
y: e.changedTouches[i].clientY
y: e.changedTouches[i].clientY,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/TouchEnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
for (var i = 0; i < e.changedTouches.length; i++) {
lang.hitch(element,element._handleTouchEvent(this.name,{
x: e.changedTouches[i].clientX,
y: e.changedTouches[i].clientY
y: e.changedTouches[i].clientY,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/TouchMove.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
for (var i = 0; i < e.changedTouches.length; i++) {
lang.hitch(element,element._handleTouchEvent(this.name,{
x: e.changedTouches[i].clientX,
y: e.changedTouches[i].clientY
y: e.changedTouches[i].clientY,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down
3 changes: 2 additions & 1 deletion mobileweb/titanium/Ti/_/Gestures/TouchStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ define(["Ti/_/declare", "Ti/_/lang","Ti/_/Gestures/GestureRecognizer"], function
for (var i = 0; i < e.changedTouches.length; i++) {
lang.hitch(element,element._handleTouchEvent(this.name,{
x: e.changedTouches[i].clientX,
y: e.changedTouches[i].clientY
y: e.changedTouches[i].clientY,
source: this.getSourceNode(e,element)
}));
}
}
Expand Down