From b26092b7a251c44e81a0e4ddcf9617f47830a617 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 16 Nov 2014 00:53:02 +0300 Subject: [PATCH] fixing, refactoring and tweaking... Signed-off-by: Alex A. Naanou --- ui (gen4)/ribbons.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/ribbons.js b/ui (gen4)/ribbons.js index f7367c87..686a7649 100755 --- a/ui (gen4)/ribbons.js +++ b/ui (gen4)/ribbons.js @@ -439,7 +439,7 @@ module.RibbonsPrototype = { // ...we need to scale it to the current scale... var shadow = setElementScale( $('
') - .addClass('shadow ribbon') + .addClass('shadow ribbon clone') .attr({ gid: gid, ticket: ticket, @@ -851,6 +851,9 @@ module.RibbonsPrototype = { .before(img) } + // cleanup source ribbons... + this.clearEmptyRibbons() + return this.updateImage(img) }, @@ -1052,7 +1055,7 @@ module.RibbonsPrototype = { var r = this.getRibbon(ribbon) if(r.length == 0){ // 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) @@ -1233,6 +1236,13 @@ module.RibbonsPrototype = { return this }, + clearEmptyRibbons: function(){ + this.viewer.find(RIBBON).filter(function(_, e){ + return $(e).children().length == 0 + }).remove() + return this + }, + // Clear elements... // // Clear all elements: