Author: pbr
Date: 2007-07-13 06:17:25 -0700 (Fri, 13 Jul 2007)
New Revision: 5663
Modified:
openlaszlo/branches/4.0/WEB-INF/lps/lfc/services/LzTrack.lzs
Log:
Change 20070712-Philip-0 by [EMAIL PROTECTED] on 2007-07-12 20:49:26 EST
in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/branches/4.0
for http://svn.openlaszlo.org/openlaszlo/branches/4.0
Summary: Moved LzTrack from legals to 4.0
New Features:
Bugs Fixed: LPP-4271
Technical Reviewer: ben
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
The current 4.0 version of /services/LzTrack.lzs is the original merge of
LzTrack.js and LzTrack.as. There was a fix to help mouse click that didn't make
it to 4.0 (r5190). I ported LzTrack to the new class system (r5298) and this is
the version I'm submitting for review. This brings this file up to the latest
legals version.
I wouldn't worry too much about reviewing the code as it has already been
reviewed by Tucker. The important thing is that it greatly improves mouse click
behavior in components.
Tests:
combobox: components_sampler in dhtml/swf
list: list_example in dhtml/swf
Files:
M WEB-INF/lps/lfc/services/LzTrack.lzs
Modified: openlaszlo/branches/4.0/WEB-INF/lps/lfc/services/LzTrack.lzs
===================================================================
--- openlaszlo/branches/4.0/WEB-INF/lps/lfc/services/LzTrack.lzs
2007-07-13 11:59:19 UTC (rev 5662)
+++ openlaszlo/branches/4.0/WEB-INF/lps/lfc/services/LzTrack.lzs
2007-07-13 13:17:25 UTC (rev 5663)
@@ -99,8 +99,9 @@
*
* @shortdesc Enables tracking mouse events over a group of views.
*/
-var LzTrack = new Object;
+class LzTrackClass {
+
/**
* @event onmousetrackover: sent when the mouse is over a view that is
registered to
* an active track group
@@ -111,16 +112,24 @@
*/
/** @access private */
-LzTrack.__LZreg = new Object; // list of registered views (that will be
tracked)
+var __LZreg = new Object; // list of registered views (that will be tracked)
/** @access private */
-LzTrack.__LZactivegroups = null;
+var __LZactivegroups = null;
/** @access private */
-LzTrack.__LZtrackDel = new LzDelegate( LzTrack , "__LZtrack" );// called on
idle
+var __LZtrackDel = null;
/** @access private */
-LzTrack.__LZoptimizeforaxis = 'x';
+var __LZoptimizeforaxis = 'x';
/** @access private */
-LzTrack.__LZmouseupDel = new LzDelegate( LzTrack , "__LZmouseup",
LzGlobalMouse, 'onmouseup');// called on global mouseup
+var __LZmouseupDel = null;
+function initialize (){
+ super.initialize.apply(this, arguments);
+
+ this.__LZtrackDel = new LzDelegate( this, "__LZtrack" );// called on idle
+ this.__LZmouseupDel = new LzDelegate( this, "__LZmouseup", LzGlobalMouse,
'onmouseup');// called on global mouseup
+}
+
+
/**
* register a view to be tracked for a particular track group
* @param LzView v: a reference to the view to add to the track group
@@ -129,7 +138,7 @@
* @devnote should we create a bounding rect for the views, or instead
register a view
* as a groups bounding rect.
*/
-LzTrack.register = function ( v, group ){
+function register ( v, group ){
if (v == null || group == null) return;
if (typeof(this.__LZreg[group]) == "undefined") {
this.__LZreg[group] = [];
@@ -149,7 +158,7 @@
/**
* @access public
*/
-LzTrack.unregister = function ( v, group ){
+function unregister ( v, group ){
if (v == null || group == null) return;
var reglist = this.__LZreg[group];
if (reglist) {
@@ -171,7 +180,7 @@
* all track groups, so we don't leak memory
* @access private
*/
-LzTrack.__LZdestroyitem = function (v){
+function __LZdestroyitem (v){
for (var i in this.__LZreg) {
this.unregister(v, i);
}
@@ -181,11 +190,11 @@
* simultaneously. This is useful for tracking mechanisms like menus.
* @param String group: the name of the track group to activate
*/
-LzTrack.activate = function ( group ){
+function activate ( group ){
if (this.__LZactivegroups == null) {
// don't want to re-register, in case we are just switching active
groups
this.__LZactivegroups = [];
- this.__LZtrackDel.register( LzGlobalMouse, "onmousemove" );
+ this.__LZtrackDel.register( LzIdle, "onidle" );
}
// see if group is already active
var found = false;
@@ -200,7 +209,7 @@
/**
* deactivate tracking for the currently active group
*/
-LzTrack.deactivate = function ( group ) {
+function deactivate ( group ) {
for (var i in this.__LZactivegroups) {
if (this.__LZactivegroups[i] == this.__LZreg[group]) {
this.__LZactivegroups.splice(i, 1);
@@ -216,7 +225,7 @@
* @access private
* returns the topmost view (a or b)
*/
-LzTrack.__LZtopview = function(a, b) {
+function __LZtopview (a, b) {
var btemp = b; var atemp=a;
while (atemp.nodeLevel < btemp.nodeLevel) {
btemp = btemp.immediateparent;
@@ -242,7 +251,7 @@
* @access private
* return topmost view in an array of views
*/
-LzTrack.__LZfindTopmost = function(vlist) {
+function __LZfindTopmost (vlist) {
var top = vlist[0];
for (var i=1; i < vlist.length; i++) {
top = this.__LZtopview(top, vlist[i]);
@@ -256,7 +265,7 @@
* iterate through a trackgroup and add those views that are under the mouse
to
* a hitlist.
*/
-LzTrack.__LZtrackgroup = function (group,hitlist) {
+function __LZtrackgroup (group,hitlist) {
//check mouse pos
// this will be slow on vertical menus because
@@ -283,7 +292,7 @@
* called on idle when the mouse is down, sends events to topmost view
* NOTE: it would be good to have bounding rectangles on these groups
*/
-LzTrack.__LZtrack = function ()
+function __LZtrack ()
{
var found = false;
var foundviews = [];
@@ -322,7 +331,7 @@
* @access private
* called before mouseup event is sent
*/
-LzTrack.__LZmouseup = function()
+function __LZmouseup ()
{
//Debug.info('LzTrack.__LZmouseup');
for (var i in this.__LZactivegroups) {
@@ -331,3 +340,11 @@
if (thisgroup && thisgroup.__LZlasthit.onmousetrackup)
thisgroup.__LZlasthit.onmousetrackup.sendEvent(this.__LZlasthit);
}
}
+
+} // End of LzTrackClass
+
+
+/** The single instance of this class
+ * @access private
+ */
+var LzTrack = new LzTrackClass;
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins