You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/07/20 09:35:55 UTC
svn commit: r965743 -
/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
Author: lofwyr
Date: Tue Jul 20 07:35:54 2010
New Revision: 965743
URL: http://svn.apache.org/viewvc?rev=965743&view=rev
Log:
TOBAGO-899: Posibility to select text inside of the sheet
Modified:
myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js?rev=965743&r1=965742&r2=965743&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Tue Jul 20 07:35:54 2010
@@ -459,7 +459,7 @@ Tobago.Sheet.prototype.addSelectionListe
if (row) {
var i = 0;
while (row) {
- // LOG.debug("rowId = " + row.id + " next i=" + i);
+ Tobago.addBindEventListener(row, "mousedown", this, "doMouseDownSelect");
Tobago.addBindEventListener(row, "click", this, "doSelection");
if (this.dblClickActionId) {
Tobago.addBindEventListener(row, "dblclick", this, "doDblClick");
@@ -470,6 +470,14 @@ Tobago.Sheet.prototype.addSelectionListe
}
};
+Tobago.Sheet.prototype.doMouseDownSelect = function(event) {
+ if (!event) {
+ event = window.event;
+ }
+ this.mouseDownX = event.clientX;
+ this.mouseDownY = event.clientY;
+};
+
Tobago.Sheet.prototype.doSelection = function(event) {
if (! event) {
event = window.event;
@@ -492,6 +500,12 @@ Tobago.Sheet.prototype.doSelection = fun
//LOG.debug("ID " + this.id);
if (! Tobago.isInputElement(srcElement.tagName)) {
+ if (Math.abs(this.mouseDownX - event.clientX) + Math.abs(this.mouseDownY - event.clientY) > 5) {
+ // The user has moved the mouse. We assume, the user want to select some text inside the sheet,
+ // so we doesn't select the row.
+ return;
+ }
+
Tobago.clearSelection();
var dataRow = Tobago.element(event);