fixing, refactoring and tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-11-16 00:53:02 +03:00
parent 952fb7f7dd
commit b26092b7a2

View File

@ -439,7 +439,7 @@ module.RibbonsPrototype = {
// ...we need to scale it to the current scale... // ...we need to scale it to the current scale...
var shadow = setElementScale( var shadow = setElementScale(
$('<div>') $('<div>')
.addClass('shadow ribbon') .addClass('shadow ribbon clone')
.attr({ .attr({
gid: gid, gid: gid,
ticket: ticket, ticket: ticket,
@ -851,6 +851,9 @@ module.RibbonsPrototype = {
.before(img) .before(img)
} }
// cleanup source ribbons...
this.clearEmptyRibbons()
return this.updateImage(img) return this.updateImage(img)
}, },
@ -1052,7 +1055,7 @@ module.RibbonsPrototype = {
var r = this.getRibbon(ribbon) var r = this.getRibbon(ribbon)
if(r.length == 0){ if(r.length == 0){
// no such ribbon exists, then create and append it... // no such ribbon exists, then create and append it...
r = this.placeRibbon(ribbon, this.viewer.find('.ribbon').length) r = this.placeRibbon(ribbon, this.viewer.find(RIBBON).length)
} }
var loaded = r.find(IMAGE) var loaded = r.find(IMAGE)
@ -1233,6 +1236,13 @@ module.RibbonsPrototype = {
return this return this
}, },
clearEmptyRibbons: function(){
this.viewer.find(RIBBON).filter(function(_, e){
return $(e).children().length == 0
}).remove()
return this
},
// Clear elements... // Clear elements...
// //
// Clear all elements: // Clear all elements: