Ticket #1392: 1392-r6382-B1.diff
| File 1392-r6382-B1.diff, 2.5 kB (added by pgiraud, 9 months ago) |
|---|
-
tests/test_Tween.html
old new 46 46 } 47 47 48 48 function test_Tween_stop(t) { 49 t.plan( 1);49 t.plan(2); 50 50 51 51 var tween = new OpenLayers.Tween(); 52 52 tween.interval = window.setInterval(function() {}, 10); 53 tween.playing = true; 53 54 tween.stop(); 54 55 t.eq(tween.interval, null, "tween correctly stopped"); 56 57 tween.interval = window.setInterval(function() {}, 10); 58 tween.playing = false; 59 tween.stop(); 60 t.ok(tween.interval != null, "stop method doesn't do anything if tween isn't running"); 55 61 } 56 62 57 63 </script> -
lib/OpenLayers/Map.js
old new 318 318 * Default is to fall through. 319 319 */ 320 320 fallThrough: true, 321 322 /** 323 * Property: panTween 324 * {OpenLayers.Tween} Animated panning tween object, see panTo() 325 */ 326 panTween: null, 321 327 322 328 /** 323 329 * Constructor: OpenLayers.Map -
lib/OpenLayers/Tween.js
old new 58 58 */ 59 59 interval: null, 60 60 61 /** 62 * Property: playing 63 * {Boolean} Tells if the easing is currently playing 64 */ 65 playing: false, 66 61 67 /** 62 68 * Constructor: OpenLayers.Tween 63 69 * Creates a Tween. … … 80 86 * options - {Object} hash of options (for example callbacks (start, eachStep, done)) 81 87 */ 82 88 start: function(begin, finish, duration, options) { 89 this.playing = true; 83 90 this.begin = begin; 84 91 this.finish = finish; 85 92 this.duration = duration; … … 98 105 99 106 /** 100 107 * APIMethod: stop 101 * Stops the Tween, and calls the finish callback 108 * Stops the Tween, and calls the done callback 109 * Doesn't do anything if animation is already finished 102 110 */ 103 111 stop: function() { 112 if (!this.playing) { 113 return 114 } 115 104 116 if (this.callbacks && this.callbacks.done) { 105 117 this.callbacks.done.call(this, this.finish); 106 118 } 107 119 window.clearInterval(this.interval); 108 120 this.interval = null; 121 this.playing = false; 109 122 }, 110 123 111 124 /**
