This commit is contained in:
javi 2013-09-11 13:21:20 +02:00
parent e658a5ec15
commit 9086919abe
5 changed files with 36 additions and 14 deletions

View File

@ -2,9 +2,9 @@
exports.torque = exports.torque || {}; exports.torque = exports.torque || {};
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(c) { setTimeout(c, 16); }
var cancelAnimationFrame = window.requestAnimationFrame || window.mozCancelAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; var cancelAnimationFrame = window.requestAnimationFrame || window.mozCancelAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(c) { cancelTimeout(c); };
/** /**
* options: * options:

View File

@ -63,7 +63,6 @@ GMapsTorqueLayer.prototype = _.extend({},
this.provider = new this.providers[this.options.provider](this.options); this.provider = new this.providers[this.options.provider](this.options);
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), this.options); this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), this.options);
console.log(this.getCanvas());
this._initTileLoader(this.options.map, this.getProjection()); this._initTileLoader(this.options.map, this.getProjection());

View File

@ -1,8 +1,12 @@
(function(exports) { (function(exports) {
exports.torque = exports.torque || {}; var torque = exports.torque = exports.torque || {};
var providers = exports.torque.providers = exports.torque.providers || {}; var providers = exports.torque.providers = exports.torque.providers || {};
var Uint8Array = torque.types.Uint8Array;
var Int32Array = torque.types.Int32Array;
var Uint32Array = torque.types.Uint32Array;
// format('hello, {0}', 'rambo') -> "hello, rambo" // format('hello, {0}', 'rambo') -> "hello, rambo"
function format(str) { function format(str) {
for(var i = 1; i < arguments.length; ++i) { for(var i = 1; i < arguments.length; ++i) {

View File

@ -1,8 +1,13 @@
(function(exports) { (function(exports) {
exports.torque = exports.torque || {};
var torque = exports.torque = exports.torque || {};
var providers = exports.torque.providers = exports.torque.providers || {}; var providers = exports.torque.providers = exports.torque.providers || {};
var Uint8Array = torque.types.Uint8Array;
var Int32Array = torque.types.Int32Array;
var Uint32Array = torque.types.Uint32Array;
// format('hello, {0}', 'rambo') -> "hello, rambo" // format('hello, {0}', 'rambo') -> "hello, rambo"
function format(str, attrs) { function format(str, attrs) {
for(var i = 1; i < arguments.length; ++i) { for(var i = 1; i < arguments.length; ++i) {
@ -51,6 +56,9 @@
return keys; return keys;
}, },
/** /**
* *
*/ */

View File

@ -2,17 +2,28 @@
var torque = exports.torque = exports.torque || {}; var torque = exports.torque = exports.torque || {};
torque.net = torque.net || {}; torque.net = torque.net || {};
function get(url, callback) { function get(url, callback) {
var req = new XMLHttpRequest(); var request = XMLHttpRequest;
req.onreadystatechange = function() { // from d3.js
if (req.readyState == 4){ if (window.XDomainRequest
if (req.status == 200){ && !("withCredentials" in request)
&& /^(http(s)?:)?\/\//.test(url)) request = XDomainRequest;
var req = new request();
function respond() {
var status = req.status, result;
if (!status && req.responseText || status >= 200 && status < 300 || status === 304) {
callback(req); callback(req);
} else { } else {
callback(null); callback(null);
} }
} }
};
"onload" in req
? req.onload = req.onerror = respond
: req.onreadystatechange = function() { req.readyState > 3 && respond(); };
req.open("GET", url, true); req.open("GET", url, true);
//req.responseType = 'arraybuffer'; //req.responseType = 'arraybuffer';