Index: branches/MwEmbedStandAlone/components/mw.Api.js |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | } |
180 | 180 | }, mw.getConfig( 'defaultRequestTimeout' ) * 1000 ); |
181 | 181 | |
182 | | - mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
| 182 | + //mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
183 | 183 | |
184 | 184 | // Check if the request requires a "post" |
185 | 185 | if( mw.checkRequestPost( data ) ) { |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -88,8 +88,8 @@ |
89 | 89 | // Get all the draw elements from the body this time: |
90 | 90 | this.getElementsForTime( time , |
91 | 91 | /* SMIL Element in Range */ |
92 | | - function( smilElement) { |
93 | | - //mw.log("SmilBody::renderTime: Element in Range" + $j( smilElement ).attr('id')); |
| 92 | + function( smilElement) { |
| 93 | + //mw.log("SmilBody::renderTime: Element in Range:" + $j( smilElement ).attr('id')); |
94 | 94 | // var relativeTime = time - smilElement.parentTimeOffset; |
95 | 95 | var relativeTime = time - $j( smilElement ).data ( 'startOffset' ); |
96 | 96 | |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | }, |
103 | 103 | /* SMIL Element out of range */ |
104 | 104 | function( smilElement ){ |
105 | | - //mw.log("SmilBody::renderTime: Element out of Range" + $j( smilElement ).attr('id')); |
| 105 | + //mw.log("SmilBody::renderTime: Element out of Range:" + $j( smilElement ).attr('id')); |
106 | 106 | // Stop the animation or playback |
107 | 107 | _this.smil.getAnimate().pauseAnimation( smilElement ) |
108 | 108 | |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | $j( smilElement ).data('activePlayback', false) |
114 | 114 | |
115 | 115 | // Expire transitions if needed |
116 | | - _this.smil.getTransitions().elementOutOfRange( smilElement, time ); |
| 116 | + _this.smil.getTransitions().hideTransitionElements( smilElement, time ); |
117 | 117 | } |
118 | 118 | ); |
119 | 119 | }, |
— | — | @@ -247,12 +247,12 @@ |
248 | 248 | var startOffset = $node.data( 'startOffset' ); |
249 | 249 | var nodeDuration = _this.getClipDuration( $node ); |
250 | 250 | |
251 | | - /* |
252 | | - * mw.log("Checking if ref: " + $node.attr('id') + ' is in range:' + time + ' >= ' + |
| 251 | + |
| 252 | + /*mw.log("Checking if ref: " + $node.attr('id') + ' is in range:' + time + ' >= ' + |
253 | 253 | $node.data( 'startOffset' ) + ' && '+ time +' < ' +startOffset + ' + ' + nodeDuration + "\n" + |
254 | 254 | ' inrage cb: ' + typeof inRangeCallback + ' eval::' + |
255 | | - ( time >= startOffset && time < ( startOffset + nodeDuration) ) + "\n\n" ); |
256 | | - */ |
| 255 | + ( time >= startOffset && time < ( startOffset + nodeDuration) ) + "\n\n" );*/ |
| 256 | + |
257 | 257 | // Check if element is in range: |
258 | 258 | if( time >= startOffset && time < ( startOffset + nodeDuration) ){ |
259 | 259 | if( typeof inRangeCallback == 'function' ){ |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilTransitions.js |
— | — | @@ -10,57 +10,68 @@ |
11 | 11 | this.smil = smilObject; |
12 | 12 | }, |
13 | 13 | |
| 14 | + getTransitionInRange: function( smilElement, animateTime ) { |
| 15 | + var _this = this; |
| 16 | + var inRangeTransitions = []; |
| 17 | + var transitionDirections = ['transIn', 'transOut']; |
| 18 | + $j.each( transitionDirections, function(inx, transitionDirection ){ |
| 19 | + if( $j( smilElement ).attr( transitionDirection ) ){ |
| 20 | + $transition = _this.smil.$dom.find( '#' + $j( smilElement ).attr( transitionDirection) ); |
| 21 | + var transitionDuration = _this.smil.parseTime( $transition.attr('dur') ); |
| 22 | + // Check if the transition is in range |
| 23 | + var percent = false; |
| 24 | + if( transitionDirection == 'transIn' ){ |
| 25 | + if ( transitionDuration > animateTime ){ |
| 26 | + percent = animateTime / transitionDuration; |
| 27 | + } |
| 28 | + } |
| 29 | + if( transitionDirection == 'transOut' ){ |
| 30 | + var nodeDuration = _this.smil.getBody().getClipDuration( smilElement ); |
| 31 | + if( animateTime > ( nodeDuration - transitionDuration ) ){ |
| 32 | + percent = animateTime - ( nodeDuration - transitionDuration ) / transitionDuration; |
| 33 | + } |
| 34 | + // Invert the percentage for "transOut" |
| 35 | + percent = 1 - percent; |
| 36 | + } |
| 37 | + if( percent !== false ){ |
| 38 | + inRangeTransitions.push( { |
| 39 | + 'transition': $transition, |
| 40 | + 'percent': percent |
| 41 | + }) |
| 42 | + } |
| 43 | + } |
| 44 | + }); |
| 45 | + return inRangeTransitions; |
| 46 | + }, |
| 47 | + |
| 48 | + // Returns true if a transition is in rage false if not |
| 49 | + hasTransitionInRange : function( smilElement, animateTime ) { |
| 50 | + return ( this.getTransitionInRange( smilElement, animateTime ) != 0 ); |
| 51 | + }, |
| 52 | + |
| 53 | + // hide any associative transition overlays ( ie the element is no longer displayed ) |
| 54 | + hideElementOverlays: function( smilElement ){ |
| 55 | + |
| 56 | + }, |
| 57 | + |
14 | 58 | // Generates a transition overlay based on the transition type |
15 | 59 | transformTransitionOverlay: function( smilElement, animateTime ) { |
| 60 | + var _this = this; |
16 | 61 | /*mw.log('SmilTransitions::transformTransitionOverlay:' + animateTime + |
17 | 62 | ' tIn:' + $j( smilElement ).attr( 'transIn' ) + |
18 | | - ' tOut:' + $j( smilElement ).attr( 'transOut' ) ); |
19 | | - */ |
20 | | - // Get the transition type and id: |
21 | | - var transitionInRange = false; |
| 63 | + ' tOut:' + $j( smilElement ).attr( 'transOut' ) );*/ |
22 | 64 | |
23 | | - if( $j( smilElement ).attr( 'transIn' ) ){ |
24 | | - $transition = this.smil.$dom.find( '#' + $j( smilElement ).attr( 'transIn' ) ); |
25 | | - // Check if the transition is in range |
26 | | - var transitionDuration = this.smil.parseTime( $transition.attr('dur') ); |
27 | | - //mw.log("SmilTransitions: test: td:" + transitionDuration + ' > ' + animateTime); |
28 | | - if( transitionDuration > animateTime ){ |
29 | | - var percent = animateTime / transitionDuration; |
30 | | - /* mw.log("SmilTransitions: " + $j( smilElement ).attr( 'transIn' ) + " in range for " + |
31 | | - this.smil.getSmilElementPlayerID( smilElement ) + " draw:" + percent ); |
32 | | - */ |
33 | | - this.drawTransition( percent, $transition, smilElement ); |
34 | | - transitionInRange = true; |
35 | | - } else { |
36 | | - // Out of range hide this overlay |
37 | | - $j( '#' + this.getTransitionOverlayId( $transition, smilElement ) ).hide(); |
38 | | - } |
39 | | - } |
40 | | - |
41 | | - if( $j( smilElement ).attr( 'transOut' ) ){ |
42 | | - $transition = this.smil.$dom.find( '#' + $j( smilElement ).attr( 'transOut' ) ); |
43 | | - // Check if the transition is in range |
44 | | - var duration = this.smil.parseTime( $transition.attr('dur') ); |
45 | | - var nodeDuration = this.smil.getBody().getClipDuration( smilElement ); |
46 | | - if( animateTime > ( nodeDuration - duration ) ){ |
47 | | - var percent = animateTime - ( nodeDuration - duration ) / duration; |
48 | | - // Invert the percentage for "transOut" |
49 | | - percent = 1 - percent; |
50 | | - |
51 | | - this.drawTransition( percent, $transition, smilElement ); |
52 | | - transitionInRange = true; |
53 | | - } else { |
54 | | - // Hide this overlay |
55 | | - $j( '#' + this.getTransitionOverlayId( $transition, smilElement ) ).hide(); |
56 | | - } |
57 | | - } |
58 | | - return transitionInRange; |
| 65 | + // Get the transition in range |
| 66 | + var transitionInRange = this.getTransitionInRange( smilElement, animateTime ); |
| 67 | + $j.each( transitionInRange, function(inx, tran){ |
| 68 | + _this.drawTransition( tran.percent, tran.transition, smilElement ); |
| 69 | + }); |
59 | 70 | }, |
60 | 71 | |
61 | 72 | /** |
62 | | - * elementOutOfRange check if an elements transition overlays are out of range and hide them |
| 73 | + * hideTransitionElements hides transition overlays that are out of range |
63 | 74 | */ |
64 | | - elementOutOfRange: function ( smilElement, time ){ |
| 75 | + hideTransitionElements: function ( smilElement ){ |
65 | 76 | // for now just hide |
66 | 77 | if( $j( smilElement ).attr( 'transIn' ) ){ |
67 | 78 | $j( '#' + |
— | — | @@ -118,7 +129,7 @@ |
119 | 130 | transitionFunctionMap : { |
120 | 131 | 'fade' : { |
121 | 132 | 'fadeFromColor': function( _this, percent, $transition, smilElement ){ |
122 | | - // Add the overlay if missing |
| 133 | + // Add the overlay if missing |
123 | 134 | var transitionOverlayId = _this.getTransitionOverlayId( $transition, smilElement ); |
124 | 135 | if( $j( '#' + transitionOverlayId ).length == 0 ){ |
125 | 136 | |
— | — | @@ -138,7 +149,7 @@ |
139 | 150 | percent = 1 - percent; |
140 | 151 | |
141 | 152 | // Update the overlay opacity |
142 | | - $j( '#' + transitionOverlayId ).css( 'opacity', percent ); |
| 153 | + $j( '#' + transitionOverlayId ).show().css( 'opacity', percent ); |
143 | 154 | }, |
144 | 155 | 'crossfade': function( _this, percent, $transition, smilElement ){ |
145 | 156 | // fade "ourselves" ... in cases of overlapping timelines this will create a true cross fade |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | */ |
76 | 76 | animateTransform: function( smilElement, animateTime, deltaTime ){ |
77 | 77 | var _this = this; |
78 | | - //mw.log("SmilAnimate::animateTransform:" + smilElement.id + ' AnimateTime: ' + animateTime + ' delta:' + deltaTime); |
| 78 | + //mw.log("SmilAnimate::animateTransform:" + $j( smilElement).attr('id') + ' AnimateTime: ' + animateTime + ' delta:' + deltaTime); |
79 | 79 | |
80 | 80 | // Check for deltaTime to animate over, if zero |
81 | 81 | if( !deltaTime || deltaTime === 0 ){ |
— | — | @@ -145,6 +145,13 @@ |
146 | 146 | checkForTransformUpdate: function( smilElement, animateTime, deltaTime ){ |
147 | 147 | // Get the node type: |
148 | 148 | var refType = this.smil.getRefType( smilElement ) |
| 149 | + // Check for transtion in range |
| 150 | + if( refType != 'audio' |
| 151 | + && |
| 152 | + this.smil.getTransitions().hasTransitionInRange( smilElement, animateTime ) |
| 153 | + ){ |
| 154 | + return true; |
| 155 | + } |
149 | 156 | |
150 | 157 | // Let transition check for updates |
151 | 158 | if( refType == 'img' || refType=='video' ){ |
— | — | @@ -187,15 +194,15 @@ |
188 | 195 | * Transform Element in an inner animation loop |
189 | 196 | */ |
190 | 197 | transformAnimateFrame: function( smilElement, animateTime ){ |
191 | | - // Audio / Video has no inner animation per-frame transforms |
192 | | - if( this.smil.getRefType( smilElement ) != 'video' |
193 | | - && |
194 | | - this.smil.getRefType( smilElement ) != 'audio' |
195 | | - ){ |
| 198 | + var refType = this.smil.getRefType( smilElement ); |
| 199 | + // Audio / Video has no inner animation per-frame transforms ( aside from |
| 200 | + if( refType != 'video' && refType != 'audio' ){ |
196 | 201 | this.transformElement( smilElement, animateTime ); |
197 | 202 | } |
198 | | - // Update the smil Element transition: |
199 | | - this.smil.getTransitions().transformTransitionOverlay( smilElement, animateTime ); |
| 203 | + // Update the smil Element transition ( applies to all visual media types ) |
| 204 | + if( refType != 'audio' ){ |
| 205 | + this.smil.getTransitions().transformTransitionOverlay( smilElement, animateTime ); |
| 206 | + } |
200 | 207 | }, |
201 | 208 | |
202 | 209 | /** |
— | — | @@ -214,11 +221,9 @@ |
215 | 222 | this.transformImageForTime( smilElement, animateTime ); |
216 | 223 | break; |
217 | 224 | case 'video': |
| 225 | + case 'audio': |
218 | 226 | this.transformMediaForTime( smilElement, animateTime ); |
219 | 227 | break; |
220 | | - case 'audio': |
221 | | - // audio has no frame transform ( only playback ) |
222 | | - break; |
223 | 228 | } |
224 | 229 | }, |
225 | 230 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | // Reset the pausedForBuffer flag: |
288 | 288 | this.pausedForBuffer = false; |
289 | 289 | |
290 | | - //mw.log( "Call animateTime: " + this.smilPlayTime); |
| 290 | + mw.log( "Call animateTime: " + this.smilPlayTime); |
291 | 291 | // Issue an animate time request with monitorDelta |
292 | 292 | this.smil.animateTime( this.smilPlayTime, this.monitorRate ); |
293 | 293 | } |
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php |
— | — | @@ -54,6 +54,7 @@ |
55 | 55 | 'mwe-sequencer-tools-transitions-desc' => 'Set in and out Transitions', |
56 | 56 | 'mwe-sequencer-tools-transitions-transIn' => 'Transition in', |
57 | 57 | 'mwe-sequencer-tools-transitions-transOut' => 'Transition out', |
| 58 | + 'mwe-sequencer-tools-transitions-color' => 'Color', |
58 | 59 | |
59 | 60 | 'mwe-sequencer-clip-cancel-edit' => 'Cancel clip edit', |
60 | 61 | 'mwe-sequencer-preview' => 'Preview', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | 'editType' : 'hidden' |
254 | 254 | }, |
255 | 255 | 'dur' : { |
256 | | - 'value' : '2s', |
| 256 | + 'value' : '0:02', |
257 | 257 | 'editType' : 'time' |
258 | 258 | }, |
259 | 259 | }, |
— | — | @@ -292,8 +292,8 @@ |
293 | 293 | buildAttributeSet: function( transitionType ){ |
294 | 294 | var attributes = {}; |
295 | 295 | for( var i in this.transitionTypes[ transitionType ] ){ |
296 | | - if( i == 'extends' ){ |
297 | | - $j.extend( attributes, this.buildAttributeSet( i ) ); |
| 296 | + if( i == 'extends' ){ |
| 297 | + $j.extend( attributes, this.buildAttributeSet( this.transitionTypes[ transitionType ][i] ) ); |
298 | 298 | } else { |
299 | 299 | attributes[ i ] = this.transitionTypes[ transitionType ][i]; |
300 | 300 | } |
— | — | @@ -308,8 +308,21 @@ |
309 | 309 | // but in the sequencer context we want unique transitions so that each can be customized |
310 | 310 | // independently. |
311 | 311 | return $j( smilElement ).attr('id') + '_' + transitionType; |
312 | | - }, |
| 312 | + }, |
313 | 313 | |
| 314 | + // Get a transition element ( if it does not exist add it ) |
| 315 | + getTransitionElement: function( _this, smilElement, transitionType ){ |
| 316 | + var $smilDom = _this.sequencer.getSmil().$dom; |
| 317 | + var transId = this.getTransitionId( smilElement, transitionType ); |
| 318 | + if( $smilDom.find( '#' + transId ).length == 0 ){ |
| 319 | + $smilDom.find('head').append( |
| 320 | + $j('<transition />') |
| 321 | + .attr('id', transId ) |
| 322 | + ); |
| 323 | + } |
| 324 | + return $smilDom.find( '#' + transId ); |
| 325 | + }, |
| 326 | + |
314 | 327 | getSelectedTransitionType: function(smilElement, transitionDirection ){ |
315 | 328 | var attributeValue = $j( smilElement ).attr( transitionDirection ); |
316 | 329 | if( !attributeValue ) |
— | — | @@ -318,43 +331,90 @@ |
319 | 332 | }, |
320 | 333 | |
321 | 334 | getBindedTranstionEdit: function( _this, smilElement, transitionType ){ |
322 | | - var $smilDom = _this.sequencer.getSmil().$dom; |
323 | | - var $editTransitionsSet = $j('<span />'); |
| 335 | + var _editTransitions = this; |
| 336 | + var $editTransitionsSet = $j('<div />'); |
| 337 | + // return the empty div on empty transtionType |
| 338 | + if( transitionType == '' ){ |
| 339 | + return $editTransitionsSet |
| 340 | + } |
| 341 | + |
324 | 342 | // Get the smil transition element |
325 | | - var $smilTransitionElement = $smilDom.find( '#' + this.getTransitionId( smilElement, transitionType ) ); |
| 343 | + var $smilTransitionElement = this.getTransitionElement( _this, smilElement, transitionType ) |
326 | 344 | // Get all the editable attributes for transitionName |
327 | 345 | var attributeSet = this.buildAttributeSet( transitionType ); |
328 | | - for( var i in attributeSet ){ |
329 | | - var transitionAttribute = attributeSet[i]; |
| 346 | + |
| 347 | + $j.each( attributeSet, function( attributeKey, transitionAttribute ){ |
330 | 348 | // Skip setup attributes |
331 | | - if( i == 'extends' || i == 'selectable' ){ |
332 | | - continue; |
| 349 | + if( attributeKey == 'extends' || attributeKey == 'selectable' ){ |
| 350 | + return true; |
333 | 351 | } |
| 352 | + var initialValue = $smilTransitionElement.attr( attributeKey ); |
| 353 | + // Set to the default value if the transition attribute has no attribute key |
| 354 | + if( !initialValue){ |
| 355 | + initialValue = transitionAttribute.value |
| 356 | + $smilTransitionElement.attr( attributeKey, transitionAttribute.value ) |
| 357 | + } |
| 358 | + |
334 | 359 | if( transitionAttribute.editType == 'time' ){ |
335 | 360 | $editTransitionsSet.append( |
336 | | - $j('<input />') |
337 | | - .attr('size', 5) |
338 | | - .change(function(){ |
339 | | - var timeValue = mw.pa$j(this).val(); |
| 361 | + _this.getInputBox({ |
| 362 | + 'title' : gM('mwe-sequencer-tools-duration'), |
| 363 | + 'inputSize' : 5, |
| 364 | + 'initialValue' :initialValue, |
| 365 | + 'change': function(){ |
| 366 | + // parse smil time |
| 367 | + var time = _this.sequencer.getSmil().parseTime( $j(this).val() ); |
| 368 | + // Check if time > clip duration |
| 369 | + if( time > $j( smilElement ).attr('dur') ){ |
| 370 | + time = $j( smilElement ).attr('dur'); |
| 371 | + } |
| 372 | + if( time < 0 ) |
| 373 | + time = 0; |
| 374 | + // Update the input value |
| 375 | + $j( this ).val( mw.seconds2npt( time ) ); |
| 376 | + // Update the smil attribute |
| 377 | + $smilTransitionElement.attr( attributeKey, time ); |
| 378 | + // run the onChange action |
| 379 | + _editTransitions.onChange( _this, smilElement ); |
| 380 | + } |
340 | 381 | }) |
341 | 382 | ) |
| 383 | + } else if ( transitionAttribute.editType == 'color' ){ |
| 384 | + $inputBox = _this.getInputBox({ |
| 385 | + 'title' : gM('mwe-sequencer-tools-transitions-color'), |
| 386 | + 'inputSize' : 8, |
| 387 | + 'initialValue' : initialValue, |
| 388 | + 'change': function(){ |
| 389 | + var cat = $j(this).val(); |
| 390 | + debugger; |
| 391 | + } |
| 392 | + }) |
| 393 | + // xxx add the color picker: |
| 394 | + $editTransitionsSet.append( $inputBox ); |
342 | 395 | } |
343 | | - |
344 | | - |
345 | | - } |
| 396 | + }) |
| 397 | + return $editTransitionsSet; |
346 | 398 | }, |
347 | 399 | |
348 | | - 'onChange': function( _this, smilElement, target ){ |
| 400 | + 'onChange': function( _this, smilElement ){ |
| 401 | + // Update the sequence duration : |
| 402 | + _this.sequencer.getEmbedPlayer().getDuration( true ); |
349 | 403 | |
| 404 | + // Seek to "this clip" |
| 405 | + _this.sequencer.getEmbedPlayer().setCurrentTime( |
| 406 | + $j( smilElement ).data('startOffset') |
| 407 | + ); |
350 | 408 | }, |
351 | 409 | 'draw': function( _this, target, smilElement ){ |
352 | 410 | // draw the two attribute types |
353 | | - $transitionWidget = $j('<div />'); |
| 411 | + var _editTransitions = this; |
| 412 | + var $transitionWidget = $j('<div />'); |
354 | 413 | |
355 | 414 | var transitionDirections = ['transIn', 'transOut']; |
356 | | - for( var i in transitionDirections ){ |
357 | | - var transitionDirection = transitionTypes[i]; |
| 415 | + $j.each(transitionDirections, function( inx, transitionDirection ){ |
358 | 416 | $transitionWidget.append( |
| 417 | + $j('<div />').css('clear', 'both') |
| 418 | + , |
359 | 419 | $j('<h3 />').text( gM('mwe-sequencer-tools-transitions-' + transitionDirection )) |
360 | 420 | ) |
361 | 421 | // Output the top level empty select |
— | — | @@ -362,50 +422,65 @@ |
363 | 423 | $j('<option />') |
364 | 424 | .attr('value', '') |
365 | 425 | ); |
366 | | - var selectedTransitionType = this.getSelectedTransitionType(smilElement, transitionDirection); |
367 | | - for( var j in this.transitionTypes ){ |
368 | | - if( this.transitionTypes[j].selectable |
| 426 | + var selectedTransitionType = _editTransitions.getSelectedTransitionType( smilElement, transitionDirection); |
| 427 | + for( var transitionType in _editTransitions.transitionTypes ){ |
| 428 | + if( _editTransitions.transitionTypes[ transitionType ].selectable |
369 | 429 | && |
370 | | - $j.inArray( transitionType, this.transitionTypes[j].selectable ) !== -1 ) |
| 430 | + $j.inArray( transitionDirection, _editTransitions.transitionTypes[transitionType].selectable ) !== -1 ) |
371 | 431 | { |
372 | | - // output the item if its selecteable for the current transitionType |
| 432 | + // Output the item if its selectable for the current transitionType |
373 | 433 | var $option = $j("<option />") |
374 | | - .attr('value', this.transitionTypes[j]) |
375 | | - .text( this.transitionTypes[j] ) |
| 434 | + .attr('value', transitionType ) |
| 435 | + .text( transitionType ) |
376 | 436 | // Add selected attribute if selected: |
377 | | - if( selectedTransitionType == this.transitionTypes[j] ){ |
| 437 | + if( selectedTransitionType == transitionType ){ |
378 | 438 | $option.attr('selected', 'true'); |
379 | 439 | } |
380 | 440 | $transSelect.append( $option ); |
381 | 441 | } |
382 | 442 | } |
383 | | - // add the select |
384 | | - $transitionWidget.append( $transSelect ); |
| 443 | + $transSelect.change( function(){ |
| 444 | + var transitionType = $j(this).val(); |
| 445 | + $transitionWidget.find( '#' + transitionDirection + '_attributeContainer' ).html( |
| 446 | + _editTransitions.getBindedTranstionEdit( |
| 447 | + _this, smilElement, transitionType |
| 448 | + ) |
| 449 | + ) |
| 450 | + // Update the smil attribute: |
| 451 | + $j( smilElement ).attr( |
| 452 | + transitionDirection, |
| 453 | + _editTransitions.getTransitionId( smilElement, transitionType ) |
| 454 | + ) |
| 455 | + // Update the player on select change |
| 456 | + _editTransitions.onChange( _this, smilElement ); |
| 457 | + }); |
| 458 | + |
| 459 | + // Add the select to the $transitionWidget |
| 460 | + $transitionWidget.append( $transSelect ); |
385 | 461 | |
386 | 462 | // Set up the transConfig container: |
387 | 463 | var $transConfig = $j('<span />') |
388 | | - .addClass('transConfig'); |
| 464 | + .attr('id', transitionDirection + '_attributeContainer'); |
| 465 | + |
389 | 466 | // If a given transition type is selected output is editable attributes |
390 | 467 | if( selectedTransitionType != '' ) { |
391 | | - $transConfig.append( |
392 | | - this.getBindedTranstionEdit( |
393 | | - smilElement, selectedTransitionType |
394 | | - ) |
| 468 | + $transConfig.append( |
| 469 | + _editTransitions.getBindedTranstionEdit( |
| 470 | + _this, smilElement, selectedTransitionType |
| 471 | + ) |
395 | 472 | ) |
396 | 473 | } |
| 474 | + $transitionWidget.append( $transConfig ); |
397 | 475 | |
398 | | - $transitionWidget.append( $transConfig ); |
399 | | - } |
400 | | - |
401 | | - return $transitionWidget; |
402 | | - }, |
403 | | - 'drawTransitionType':function( attributeType ){ |
404 | | - |
405 | | - } |
406 | | - |
| 476 | + // update the player for the default selected set. |
| 477 | + _editTransitions.onChange( _this, smilElement ); |
| 478 | + }); |
| 479 | + // add the transition widget to the target |
| 480 | + $j( target ).append( $transitionWidget ); |
| 481 | + } |
407 | 482 | }, |
408 | 483 | 'editTemplate':{ |
409 | | - 'onChange' : function( _this, smilElement, target ){ |
| 484 | + 'onChange' : function( _this, smilElement ){ |
410 | 485 | // Clear the smilElement template cache: |
411 | 486 | $j( smilElement ).data('templateHtmlCache', null); |
412 | 487 | // Re draw the smilElement in the player |
— | — | @@ -428,7 +503,7 @@ |
429 | 504 | _this.sequencer |
430 | 505 | .getServer() |
431 | 506 | .getTemplateText( $j( smilElement).attr('apititlekey'), function( templateText ){ |
432 | | - mw.log("GotTemplateText: " + templateText ); |
| 507 | + //mw.log("GotTemplateText: " + templateText ); |
433 | 508 | if( ! templateText || typeof templateText != 'string' ){ |
434 | 509 | mw.log("Error: could not get wikitext form titlekey: " + $j( smilElement).attr('apititlekey')) |
435 | 510 | return ; |
— | — | @@ -467,8 +542,7 @@ |
468 | 543 | .change(function(){ |
469 | 544 | _this.editWidgets.editTemplate.onChange( |
470 | 545 | _this, |
471 | | - smilElement, |
472 | | - target |
| 546 | + smilElement |
473 | 547 | ) |
474 | 548 | }) |
475 | 549 | .parent() |
— | — | @@ -483,7 +557,7 @@ |
484 | 558 | } |
485 | 559 | }, |
486 | 560 | 'panzoom' : { |
487 | | - 'onChange': function( _this, smilElement, target ){ |
| 561 | + 'onChange': function( _this, smilElement ){ |
488 | 562 | var panZoomVal = $j('#' +_this.getEditToolInputId( 'panzoom', 'panZoom')).val(); |
489 | 563 | mw.log("panzoom change:" + panZoomVal ); |
490 | 564 | |
— | — | @@ -629,7 +703,7 @@ |
630 | 704 | // Restore original css for the layout helper |
631 | 705 | $j(this).css( orginalHelperCss ) |
632 | 706 | // trigger the 'change' |
633 | | - _this.editWidgets.panzoom.onChange( _this, smilElement, target ); |
| 707 | + _this.editWidgets.panzoom.onChange( _this, smilElement ); |
634 | 708 | } |
635 | 709 | }) |
636 | 710 | .css('cursor', 'move') |
— | — | @@ -651,14 +725,14 @@ |
652 | 726 | // Restore original css |
653 | 727 | $j(this).css( orginalHelperCss ) |
654 | 728 | // trigger the change |
655 | | - _this.editWidgets.panzoom.onChange( _this, smilElement, target ); |
| 729 | + _this.editWidgets.panzoom.onChange( _this, smilElement); |
656 | 730 | } |
657 | 731 | }) |
658 | 732 | |
659 | 733 | } |
660 | 734 | }, |
661 | 735 | 'trimTimeline' : { |
662 | | - 'onChange': function( _this, smilElement, target){ |
| 736 | + 'onChange': function( _this, smilElement ){ |
663 | 737 | var smil = _this.sequencer.getSmil(); |
664 | 738 | // Update the preview thumbs |
665 | 739 | |
— | — | @@ -717,7 +791,7 @@ |
718 | 792 | |
719 | 793 | var onInputChange = function( sliderIndex, timeValue ){ |
720 | 794 | // Register the change |
721 | | - _this.editWidgets.trimTimeline.onChange( _this, smilElement, target); |
| 795 | + _this.editWidgets.trimTimeline.onChange( _this, smilElement ); |
722 | 796 | // Update the slider |
723 | 797 | if( fullClipDuration ){ |
724 | 798 | $j('#'+_this.sequencer.id + '_trimTimeline' ) |
— | — | @@ -744,7 +818,7 @@ |
745 | 819 | }); |
746 | 820 | |
747 | 821 | // Update the thumbnails: |
748 | | - _this.editWidgets.trimTimeline.onChange( _this, smilElement, target); |
| 822 | + _this.editWidgets.trimTimeline.onChange( _this, smilElement ); |
749 | 823 | |
750 | 824 | // Get the clip full duration to build out the timeline selector |
751 | 825 | smil.getBody().getClipAssetDuration( smilElement, function( clipDuration ) { |
— | — | @@ -790,7 +864,7 @@ |
791 | 865 | _this.editableTypes['time'].update( _this, smilElement, 'dur', sliderToTime( ui.values[ 1 ]- ui.values[0] ) ); |
792 | 866 | |
793 | 867 | // update the widget display |
794 | | - _this.editWidgets.trimTimeline.onChange( _this, smilElement, target); |
| 868 | + _this.editWidgets.trimTimeline.onChange( _this, smilElement ); |
795 | 869 | |
796 | 870 | // Register the edit state for undo / redo |
797 | 871 | _this.sequencer.getActionsEdit().registerEdit(); |
— | — | @@ -902,12 +976,14 @@ |
903 | 977 | ) |
904 | 978 | var $toolContainer = $toolsContainer.find( '#tooltab_' + toolId ); |
905 | 979 | |
906 | | - // Build out the attribute list for the given tool: |
907 | | - for( var i=0; i < tool.editableAttributes.length ; i++ ){ |
908 | | - attributeName = tool.editableAttributes[i]; |
909 | | - $toolContainer.append( |
910 | | - _this.getEditableAttribute( smilElement, toolId, attributeName ) |
911 | | - ); |
| 980 | + // Build out the attribute list for the given tool ( if the tool has directly editable attributes ) |
| 981 | + if( tool.editableAttributes ){ |
| 982 | + for( var i=0; i < tool.editableAttributes.length ; i++ ){ |
| 983 | + attributeName = tool.editableAttributes[i]; |
| 984 | + $toolContainer.append( |
| 985 | + _this.getEditableAttribute( smilElement, toolId, attributeName ) |
| 986 | + ); |
| 987 | + } |
912 | 988 | } |
913 | 989 | |
914 | 990 | // Output a float divider: |
— | — | @@ -1030,7 +1106,7 @@ |
1031 | 1107 | 'inputId' : _this.getEditToolInputId( toolId, updateKey ), |
1032 | 1108 | 'inputSize': inputSize, |
1033 | 1109 | 'initialValue' : initialValue, |
1034 | | - 'inputChange': function(){ |
| 1110 | + 'change': function(){ |
1035 | 1111 | // Run the editableType update function: |
1036 | 1112 | _this.editableTypes[ editType ].update( |
1037 | 1113 | _this, |
— | — | @@ -1066,7 +1142,7 @@ |
1067 | 1143 | .data('initialValue', config.initialValue ) |
1068 | 1144 | .sequencerInput( _this.sequencer ) |
1069 | 1145 | .val( config.initialValue ) |
1070 | | - .change( options.inputChange ) |
| 1146 | + .change( config.change ) |
1071 | 1147 | ); |
1072 | 1148 | } |
1073 | 1149 | } |