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 {
display: none;
}
.ribbon:first-child {
margin-top: 0;
}
.ribbon:last-child {
margin-bottom: 0;
}
.base-ribbon-marker {
position: absolute;

View File

@ -43,7 +43,7 @@ function(force, callback){
var updateImagePosition =
module.updateImagePosition =
function updateImagePosition(actions, target){
var s = actions.ribbons.getRibbonSet()
var s = actions.ribbons.getRibbonLocator()
if(s.length == 0){
return
@ -90,7 +90,8 @@ function updateImagePosition(actions, target){
to = actions.data.getRibbon(target)
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)

View File

@ -516,6 +516,9 @@ var RibbonsPrototype = {
return this
},
// XXX add angle...
// XXX
// Get visible image tile size...
//
// .getVisibleImageSize()
@ -1030,7 +1033,7 @@ var RibbonsPrototype = {
// gid...
} else if(typeof(target) == typeof('str')){
//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...
return r.length == 0
? this.getImage(target).parents('.ribbon').first()
@ -1105,6 +1108,7 @@ var RibbonsPrototype = {
ribbon_set.append(ribbon)
} else if(i == -1 || i > position) {
// XXX need to compensate for offset???
ribbons.eq(position).before(ribbon)
// for placing after need to account for target ribbon removal...
@ -2186,8 +2190,15 @@ var RibbonsPrototype = {
// center a ribbon vertically...
//
// XXX custom align point woud also be nice...
// (top, bottom, center, %, px)
// Center current ribbon...
// .centerRibbon()
// -> Ribbons
//
// Center specific ribbon...
// .centerRibbon(image)
// .centerRibbon(ribbon)
// -> Ribbons
//
centerRibbon: function(target){
var ribbon = this.getRibbon(target)
var locator = this.getRibbonLocator()
@ -2207,8 +2218,20 @@ var RibbonsPrototype = {
// center an image horizontally...
//
// XXX custom align point would also be nice...
// (top, bottom, center, %, px)
// Center current ribbon/image...
// .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){
target = this.getImage(target)
var ribbon = this.getRibbon(target)