Author: max
Date: 2007-09-04 18:43:34 -0700 (Tue, 04 Sep 2007)
New Revision: 6357
Added:
openlaszlo/branches/legals/lps/includes/source/LzMousewheelKernel.js
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzKeys.js
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/swf/LzKeys.as
openlaszlo/branches/legals/lps/includes/source/embed-library.lzs
openlaszlo/branches/legals/lps/includes/source/embednew.js
Log:
Change 20070904-maxcarlson-m by [EMAIL PROTECTED] on 2007-09-04 15:14:09 PDT
in /Users/maxcarlson/openlaszlo/legals
for http://svn.openlaszlo.org/openlaszlo/branches/legals
Summary: Add mouse wheel support for Flash on Mac
New Features:
Bugs Fixed: LPP-4129 - Fix mouse wheel in for swf on the mac
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: LzKeyboardKernel.js - Factor mousewheel kernel out into
LzMousewheelKernel.js
LzKeys.as - Refactor mouseListener code to LzKeys.__mousewheelEvent()
LzKeys.js - Use separate callback API for mousewheel
LzMousewheelKernel.js - Refactored mousewheel kernel from LzKeyboardKernel.js,
set up for multiple callbacks.
embednew.js - in swfEmbed(), if the browser OS is Mac, register
_sendMouseWheel() to receive events from LzMousewheelKernel for the current app.
embed-library.lzs - Add LzMousewheelKernel.js so it's included in
embed-compressed.js.
Tests: See LPP-4129 for a testcase. Testcase works under DHTML, flash on mac
and flash on Windows.
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
2007-09-05 01:27:30 UTC (rev 6356)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
2007-09-05 01:43:34 UTC (rev 6357)
@@ -72,37 +72,17 @@
}
//Debug.write('downKeysHash', t, k, dh, delta);
}
- ,__mousewheelEvent: function ( e ){
- if (!e) e = window.event;
- var delta = 0;
- if (e.wheelDelta) {
- delta = e.wheelDelta / 120;
- if (LzSprite.prototype.quirks['reverse_mouse_wheel']) {
- delta = -delta;
- }
- } else if (e.detail) {
- delta = -e.detail/3;
- }
- if (e.preventDefault) e.preventDefault();
- e.returnValue = false;
- if (delta && LzKeyboardKernel.__mousewheelcallback)
LzKeyboardKernel.__scope[LzKeyboardKernel.__mousewheelcallback](delta);
- }
+
,__callback: null
- ,__mousewheelcallback: null
,__scope: null
,__cancelKeys: true
- ,setCallback: function (scope, keyboardcallback, mousewheelcallback) {
+ ,setCallback: function (scope, keyboardcallback) {
this.__scope = scope;
this.__callback = keyboardcallback;
- this.__mousewheelcallback = mousewheelcallback;
if (lzOptions.dhtmlKeyboardControl != false) {
document.onkeydown = LzKeyboardKernel.__keyboardEvent;
document.onkeyup = LzKeyboardKernel.__keyboardEvent;
document.onkeypress = LzKeyboardKernel.__keyboardEvent;
- if (window.addEventListener) {
- window.addEventListener('DOMMouseScroll',
LzKeyboardKernel.__mousewheelEvent, false);
- }
- document.onmousewheel = LzKeyboardKernel.__mousewheelEvent;
}
}
}
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzKeys.js
===================================================================
---
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzKeys.js
2007-09-05 01:27:30 UTC (rev 6356)
+++
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzKeys.js
2007-09-05 01:43:34 UTC (rev 6357)
@@ -63,7 +63,8 @@
}
}
-LzKeyboardKernel.setCallback(LzKeys, '__keyboardEvent', '__mousewheelEvent');
+LzKeyboardKernel.setCallback(LzKeys, '__keyboardEvent');
+LzMousewheelKernel.setCallback(LzKeys, '__mousewheelEvent');
LzKeys.keyCodes = {
a : 65 ,
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/swf/LzKeys.as
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/swf/LzKeys.as
2007-09-05 01:27:30 UTC (rev 6356)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/swf/LzKeys.as
2007-09-05 01:43:34 UTC (rev 6357)
@@ -532,7 +532,6 @@
/** @access private */
var mouseListener = new Object();
-mouseListener.parent = this;
/**
* @field Number mousewheeldelta: the amount the mouse wheel last moved. Use
@@ -540,12 +539,17 @@
*/
LzKeys.mousewheeldelta = 0;
+/** @access private */
+LzKeys.__mousewheelEvent = function(d) {
+ this.mousewheeldelta = d;
+ if (this.onmousewheeldelta.ready) this.onmousewheeldelta.sendEvent(d);
+}
+
/**
* @access private
*/
mouseListener.onMouseWheel = function(d) {
- LzKeys.mousewheeldelta = d;
- if (LzKeys.onmousewheeldelta.ready) LzKeys.onmousewheeldelta.sendEvent(d);
+ LzKeys.__mousewheelEvent(d);
}
// SWF-specific
Mouse.addListener(mouseListener);
Added: openlaszlo/branches/legals/lps/includes/source/LzMousewheelKernel.js
Property changes on:
openlaszlo/branches/legals/lps/includes/source/LzMousewheelKernel.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/branches/legals/lps/includes/source/embed-library.lzs
===================================================================
--- openlaszlo/branches/legals/lps/includes/source/embed-library.lzs
2007-09-05 01:27:30 UTC (rev 6356)
+++ openlaszlo/branches/legals/lps/includes/source/embed-library.lzs
2007-09-05 01:43:34 UTC (rev 6357)
@@ -8,6 +8,7 @@
#include "flash.js"
#include "embednew.js"
#include "iframemanager.js"
+#include "LzMousewheelKernel.js"
// Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. Use is
// subject to license terms.
Modified: openlaszlo/branches/legals/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/branches/legals/lps/includes/source/embednew.js 2007-09-05
01:27:30 UTC (rev 6356)
+++ openlaszlo/branches/legals/lps/includes/source/embednew.js 2007-09-05
01:43:34 UTC (rev 6357)
@@ -110,6 +110,7 @@
,getCanvasAttribute: Lz._getCanvasAttributeSWF
,callMethod: Lz._callMethodSWF
,_ready: Lz._ready
+ ,_sendMouseWheel: Lz._sendMouseWheel
,_setCanvasAttributeDequeue: Lz._setCanvasAttributeDequeue
}
// for callbacks onload
@@ -122,6 +123,10 @@
if (! Lz['callMethod']) Lz.callMethod = Lz[properties.id].callMethod;
dojo.flash.setSwf(swfargs, minimumVersion);
+ Lz.__BrowserDetect.init();
+ if (Lz.__BrowserDetect.OS == 'Mac') {
+ LzMousewheelKernel.setCallback(Lz[properties.id],
'_sendMouseWheel');
+ }
}
,/**
@@ -622,5 +627,9 @@
_checkHistory: function() {
window.setInterval('Lz._checklocationhash()', 300)
}
+ ,/** @access private */
+ _sendMouseWheel: function(d) {
+ if (d != null) this.callMethod("LzKeys.__mousewheelEvent(" + d + ")");
+ }
};
window.onload = Lz._checkHistory;
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins