* Port to be Cappuccino compatible (need to use GLOBAL() in fiture)

* Reverting to my zoom method
This commit is contained in:
primalmotion 2010-08-03 13:52:56 +02:00
parent 5e5d81dd86
commit 434699bf23
2 changed files with 34 additions and 23 deletions

View File

@ -6,11 +6,11 @@
* See README.md for usage and integration instructions.
*/
"use strict";
//"use strict";
/*jslint browser: true, white: false, bitwise: false */
/*global window, Util, Base64 */
function Canvas(conf) {
Canvas = function(conf) {
conf = conf || {}; // Configuration
var that = {}, // Public API interface
@ -76,8 +76,6 @@ that.get_height = function() {
return c_height;
};
//
// Private functions
//
@ -403,30 +401,44 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
that.rescale = function(factor) {
var c, tp, x, y,
properties = ['transform', 'WebkitTransform', 'MozTransform', null];
properties = ['transform', 'WebkitTransform', 'MozTransform', 'oTransform', null],
origin = ['transformOrigin', 'WebkitTransformOrigin', 'MozTransformOrigin', 'oTransformOrigin', null];
if (conf.scale === factor) {
return;
}
c = conf.target;
tp = properties.shift();
while (tp) {
if (typeof c.style[tp] !== 'undefined') {
conf.scale = factor;
x = c.width - c.width * factor;
y = c.height - c.height * factor;
//tp = properties.shift();
if (typeof(c.style.zoom) != "undefined") {
c.style.zoom = conf.scale;
return
}
while (tp = properties.shift()) {
if (typeof c.style[tp] != 'undefined') {
break;
}
tp = properties.shift();
}
while (tpo = origin.shift()) {
if (typeof c.style[tpo] != 'undefined') {
break;
}
}
if (tp === null) {
Util.Debug("No scaling support");
return;
}
if (conf.scale === factor) {
//Util.Debug("Canvas already scaled to '" + factor + "'");
return;
}
conf.scale = factor;
x = c.width - c.width * factor;
y = c.height - c.height * factor;
c.style[tp] = "scale(" + conf.scale + ") translate(-" + x + "px, -" + y + "px)";
c.style[tpo] = "top left";
c.style[tp] = "scale(" + conf.scale + ")";
};
that.resize = function(width, height, true_color) {

View File

@ -6,13 +6,12 @@
* See README.md for usage and integration instructions.
*/
"use strict";
//"use strict";
/*jslint white: false, browser: true, bitwise: false */
/*global window, WebSocket, Util, Canvas, VNC_native_ws, Base64, DES */
function RFB(conf) {
RFB = function(conf) {
conf = conf || {}; // Configuration
var that = {}, // Public API interface