new ribbons appear to functionally be mostly done, next revision and cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-11-22 19:12:36 +03:00
parent e35b45e960
commit daa00a452c
3 changed files with 31 additions and 13 deletions

View File

@ -572,12 +572,6 @@ stretching in width... */
.ribbon:empty { .ribbon:empty {
display: none; display: none;
} }
.ribbon:first-child {
margin-top: 0;
}
.ribbon:last-child {
margin-bottom: 0;
}
.base-ribbon-marker { .base-ribbon-marker {
position: absolute; position: absolute;

View File

@ -43,7 +43,7 @@ function(force, callback){
var updateImagePosition = var updateImagePosition =
module.updateImagePosition = module.updateImagePosition =
function updateImagePosition(actions, target){ function updateImagePosition(actions, target){
var s = actions.ribbons.getRibbonSet() var s = actions.ribbons.getRibbonLocator()
if(s.length == 0){ if(s.length == 0){
return return
@ -90,7 +90,8 @@ function updateImagePosition(actions, target){
to = actions.data.getRibbon(target) to = actions.data.getRibbon(target)
if(actions.ribbons.getRibbon(to).length == 0){ if(actions.ribbons.getRibbon(to).length == 0){
actions.ribbons.placeRibbon(to, actions.data.getRibbonOrder(target)) actions.ribbons
.placeRibbon(to, actions.data.getRibbonOrder(target))
} }
actions.ribbons.placeImage(target, to) actions.ribbons.placeImage(target, to)

View File

@ -515,6 +515,9 @@ var RibbonsPrototype = {
return this return this
}, },
// XXX add angle...
// XXX
// Get visible image tile size... // Get visible image tile size...
// //
@ -1030,7 +1033,7 @@ var RibbonsPrototype = {
// gid... // gid...
} else if(typeof(target) == typeof('str')){ } else if(typeof(target) == typeof('str')){
//return this.viewer.find('.ribbon[gid="'+JSON.stringify(target)+'"]') //return this.viewer.find('.ribbon[gid="'+JSON.stringify(target)+'"]')
var r = this.viewer.find('.ribbon[gid='+JSON.stringify(target)+']') var r = this.viewer.find('.ribbon[gid='+JSON.stringify(target)+']:not(.clone)')
// if no ribbon is found, try and get an image and it's ribbon... // if no ribbon is found, try and get an image and it's ribbon...
return r.length == 0 return r.length == 0
? this.getImage(target).parents('.ribbon').first() ? this.getImage(target).parents('.ribbon').first()
@ -1105,6 +1108,7 @@ var RibbonsPrototype = {
ribbon_set.append(ribbon) ribbon_set.append(ribbon)
} else if(i == -1 || i > position) { } else if(i == -1 || i > position) {
// XXX need to compensate for offset???
ribbons.eq(position).before(ribbon) ribbons.eq(position).before(ribbon)
// for placing after need to account for target ribbon removal... // for placing after need to account for target ribbon removal...
@ -2185,9 +2189,16 @@ var RibbonsPrototype = {
}, },
// center a ribbon vertically... // center a ribbon vertically...
//
// Center current ribbon...
// .centerRibbon()
// -> Ribbons
//
// Center specific ribbon...
// .centerRibbon(image)
// .centerRibbon(ribbon)
// -> Ribbons
// //
// XXX custom align point woud also be nice...
// (top, bottom, center, %, px)
centerRibbon: function(target){ centerRibbon: function(target){
var ribbon = this.getRibbon(target) var ribbon = this.getRibbon(target)
var locator = this.getRibbonLocator() var locator = this.getRibbonLocator()
@ -2207,8 +2218,20 @@ var RibbonsPrototype = {
// center an image horizontally... // center an image horizontally...
// //
// XXX custom align point would also be nice... // Center current ribbon/image...
// (top, bottom, center, %, px) // .centerImage()
// -> Ribbons
//
// Center specific image...
// .centerImage(image)
// .centerImage(image, 'center')
// -> Ribbons
//
// Center ribbon before/after an image...
// .centerImage(image, 'before')
// .centerImage(image, 'after')
// -> Ribbons
//
centerImage: function(target, mode){ centerImage: function(target, mode){
target = this.getImage(target) target = this.getImage(target)
var ribbon = this.getRibbon(target) var ribbon = this.getRibbon(target)