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: