Ticket #616: ticket616.patch

File ticket616.patch, 1.4 KB (added by PhilHawksworth, 4 years ago)

Patch of Story,js to add an optional animationSrc parameter to the displayTiddler function

  • Story.js

     
    5757//# animate - whether to perform animations 
    5858//# customFields - an optional list of name:"value" pairs to be assigned as tiddler fields (for edit templates) 
    5959//# toggle - if true, causes the tiddler to be closed if it is already opened 
    60 Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle) 
     60//# animationSrc - optional. If provided, this will specify the element which is to act as the start of the animation -or- 
     61//#                the source of the animation will be the srcElement. 
     62Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc) 
    6163{ 
    6264        var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler; 
    6365        var tiddlerElem = this.getTiddler(title); 
     
    7173                var before = this.positionTiddler(srcElement); 
    7274                tiddlerElem = this.createTiddler(place,before,title,template,customFields); 
    7375        } 
     76        if(animationSrc && typeof animationSrc !== "string") { 
     77                srcElement = animationSrc; 
     78        } 
    7479        if(srcElement && typeof srcElement !== "string") { 
    7580                if(config.options.chkAnimate && (animate == undefined || animate == true) && anim && typeof Zoomer == "function" && typeof Scroller == "function") 
    7681                        anim.startAnimating(new Zoomer(title,srcElement,tiddlerElem),new Scroller(tiddlerElem));