Ticket #3961: lang-fx-reduction.patch
| File lang-fx-reduction.patch, 6.5 kB (added by peller, 14 months ago) |
|---|
-
Users/peller/workspace/trunk2/dojo/_base/fx.js
36 36 }, 37 37 38 38 // public properties 39 curve: null,39 // curve: null, 40 40 duration: 1000, 41 easing: null,41 // easing: null, 42 42 repeat: 0, 43 43 rate: 10, // 100 fps 44 45 /*===== 44 46 delay: null, 45 47 46 48 // events 47 49 beforeBegin: null, 48 50 onBegin: null, … … 51 53 onPlay: null, 52 54 onPause: null, 53 55 onStop: null, 56 =====*/ 54 57 55 58 // private properties 56 _active: false,57 _paused: false,58 _startTime: null,59 _endTime: null,60 _timer: null,59 // _active: false, 60 // _paused: false, 61 // _startTime: null, 62 // _endTime: null, 63 // _timer: null, 61 64 _percent: 0, 62 65 _startRepeatCount: 0, 63 66 … … 125 128 return this; // dojo._Animation 126 129 }, 127 130 128 gotoPercent: function(/*Decimal*/ p ct, /*boolean?*/ andPlay){131 gotoPercent: function(/*Decimal*/ percent, /*boolean?*/ andPlay){ 129 132 // summary: Sets the progress of the animation. 130 // p ct: A percentage in decimal notation (between and including 0.0 and 1.0).133 // percent: A percentage in decimal notation (between and including 0.0 and 1.0). 131 134 // andPlay: If true, play the animation after setting the progress. 132 135 clearTimeout(this._timer); 133 136 this._active = this._paused = true; 134 this._percent = p ct * 100;137 this._percent = percent * 100; 135 138 if(andPlay){ this.play(); } 136 139 return this; // dojo._Animation 137 140 }, … … 222 225 } 223 226 224 227 dojo._fade = function(/*Object*/ args){ 225 // summary: Returns an animation that will fade the "nodes" from the start to end values passed.228 // summary: Returns an animation that will fade the "nodes" from the start to end values passed (end is mandatory) 226 229 227 //FIXME: remove arg checking? Change docs above to show that end is not optional. Just make sure this blows up in a reliable way?228 if(typeof args.end == "undefined"){229 throw new Error("dojo._fade needs an end value");230 }231 230 args.node = dojo.byId(args.node); 232 231 var fArgs = dojo.mixin({ properties: {} }, args); 233 232 var props = (fArgs.properties.opacity = {}); … … 264 263 return dojo._fade(dojo.mixin({ end: 0 }, args)); // dojo._Animation 265 264 } 266 265 267 if(dojo.isKhtml && !dojo.isSafari){ 268 // the cool kids are obviously not using konqueror... 269 // found a very wierd bug in floats constants, 1.5 evals as 1 270 // seems somebody mixed up ints and floats in 3.5.4 ?? 271 // FIXME: investigate more and post a KDE bug (Fredrik) 272 dojo._defaultEasing = function(/*Decimal?*/ n){ 273 // summary: Returns the point for point n on a sin wave. 274 return parseFloat("0.5")+((Math.sin((n+parseFloat("1.5")) * Math.PI))/2); //FIXME: Does this still occur in the supported Safari version? 275 } 276 }else{ 277 dojo._defaultEasing = function(/*Decimal?*/ n){ 278 return 0.5+((Math.sin((n+1.5) * Math.PI))/2); 279 } 266 dojo._defaultEasing = function(/*Decimal?*/ n){ 267 return 0.5 + ((Math.sin((n + 1.5) * Math.PI))/2); 280 268 } 281 269 282 270 var PropLine = function(properties){ … … 292 280 var ret = {}; 293 281 for(var p in this._properties){ 294 282 var prop = this._properties[p]; 295 var value = null;296 if( prop.start instanceof dojo.Color){297 value = dojo.blendColors(prop.start, prop.end, r, prop.tempColor).toCss();298 }else if(!dojo.isArray( prop.start)){299 value = ((prop.end - prop.start) * r) + prop.start + (p != "opacity" ? prop.units||"px" : "");283 var start = prop.start; 284 if(start instanceof dojo.Color){ 285 ret[p] = dojo.blendColors(start, prop.end, r, prop.tempColor).toCss(); 286 }else if(!dojo.isArray(start)){ 287 ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units||"px" : ""); 300 288 } 301 ret[p] = value;302 289 } 303 290 return ret; 304 291 } … … 309 296 // defined in 'args' depending how they are defined in 'args.properties' 310 297 311 298 args.node = dojo.byId(args.node); 312 if (!args.easing){ args.easing = dojo._defaultEasing; }313 299 if(!args.easing){ args.easing = dojo._defaultEasing; } 300 314 301 var anim = new dojo._Animation(args); 315 302 dojo.connect(anim, "beforeBegin", anim, function(){ 316 303 var pm = {}; … … 318 305 // Make shallow copy of properties into pm because we overwrite some values below. 319 306 // In particular if start/end are functions we don't want to overwrite them or 320 307 // the functions won't be called if the animation is reused. 321 var prop = pm[p] = dojo.mixin({}, this.properties[p]);308 var prop = (pm[p] = dojo.mixin({}, this.properties[p])); 322 309 323 310 if(dojo.isFunction(prop.start)){ 324 311 prop.start = prop.start(); -
Users/peller/workspace/trunk2/dojo/_base/lang.js
3 3 // Crockford functions (ish) 4 4 5 5 dojo.isString = function(/*anything*/ it){ 6 // summary: Return true if it is a String .6 // summary: Return true if it is a String 7 7 return typeof it == "string" || it instanceof String; // Boolean 8 8 } 9 9 10 10 dojo.isArray = function(/*anything*/ it){ 11 // summary: Return true of it is an Array11 // summary: Return true if it is an Array 12 12 return it && it instanceof Array || typeof it == "array" || 13 ( (typeof dojo.NodeList != "undefined") && (it instanceof dojo.NodeList)); // Boolean13 (typeof dojo.NodeList != "undefined" && it instanceof dojo.NodeList); // Boolean 14 14 } 15 15 16 if(dojo.isBrowser && dojo.isSafari){ 17 // only slow this down w/ gratuitious casting in Safari since it's what's b0rken 18 dojo.isFunction = function(/*anything*/ it){ 19 if(typeof it == "function" && it == "[object NodeList]"){ return false; } 20 return typeof it == "function" || it instanceof Function; // Boolean 21 } 22 }else{ 23 dojo.isFunction = function(/*anything*/ it){ 24 return typeof it == "function" || it instanceof Function; // Boolean 25 } 16 /*===== 17 dojo.isFunction = function(it){ 18 // summary: Return true if it is a Function 19 // it: anything 26 20 } 21 =====*/ 27 22 23 dojo.isFunction = (function(){ 24 var _isFunction = function(/*anything*/ it){ 25 return typeof it == "function" || it instanceof Function; // Boolean 26 }; 27 28 return dojo.isSafari ? 29 // only slow this down w/ gratuitious casting in Safari since it's what's b0rken 30 function(/*anything*/ it){ 31 if(typeof it == "function" && it == "[object NodeList]"){ return false; } 32 return _isFunction(it); // Boolean 33 } : _isFunction; 34 })(); 35 28 36 dojo.isObject = function(/*anything*/ it){ 29 37 // summary: 30 38 // Returns true if it is a JavaScript object (or an Array, a Function or null)