forked from 0x2620/oxjs
self.setOption ~> that.update
This commit is contained in:
parent
9ee0742b53
commit
005d50c389
56 changed files with 919 additions and 933 deletions
|
|
@ -39,7 +39,56 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
widgetSize: 256,
|
||||
width: 0
|
||||
})
|
||||
.options(options || {});
|
||||
.options(options || {})
|
||||
.update(function(key, value) {
|
||||
if (key == 'highlight') {
|
||||
self.$annotations.options({highlight: value});
|
||||
}
|
||||
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
||||
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
||||
item[key] = value;
|
||||
item.duration = self.options.out - self.options['in'];
|
||||
self.points = getPoints();
|
||||
}
|
||||
if (key == 'in') {
|
||||
//fixme: array editable should support item updates while editing
|
||||
self.options.range == 'selection' && updateAnnotations();
|
||||
} else if (key == 'out') {
|
||||
self.options.range == 'selection' && updateAnnotations();
|
||||
} else if (key == 'position') {
|
||||
if (self.options.range == 'position') {
|
||||
crossesPoint() && updateAnnotations();
|
||||
self.position = self.options.position;
|
||||
}
|
||||
} else if (key == 'range') {
|
||||
updateAnnotations();
|
||||
} else if (key == 'selected') {
|
||||
if (value === '') {
|
||||
self.editing = false;
|
||||
}
|
||||
if (value && self.options.collapsed) {
|
||||
self.$panel.options({animate: false});
|
||||
self.$panel.options({collapsed: false});
|
||||
self.$panel.options({animate: true});
|
||||
}
|
||||
self.$annotations.options({selected: value});
|
||||
} else if (key == 'sort') {
|
||||
self.sort = getSort();
|
||||
self.$annotations.options({sort: self.sort});
|
||||
showWarnings();
|
||||
} else if (key == 'users') {
|
||||
updateAnnotations();
|
||||
} else if (key == 'width') {
|
||||
if (self.widget) {
|
||||
self.$outer.options({width: self.options.width});
|
||||
self.$inner.options({width: self.options.width});
|
||||
self.$widget.options({width: self.options.width});
|
||||
}
|
||||
self.$annotations.options({
|
||||
width: self.options.type == 'text' ? self.options.width + 8 : self.options.width
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (self.options.selected) {
|
||||
self.options.collapsed = false;
|
||||
|
|
@ -511,56 +560,6 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'highlight') {
|
||||
self.$annotations.options({highlight: value});
|
||||
}
|
||||
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
||||
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
||||
item[key] = value;
|
||||
item.duration = self.options.out - self.options['in'];
|
||||
self.points = getPoints();
|
||||
}
|
||||
if (key == 'in') {
|
||||
//fixme: array editable should support item updates while editing
|
||||
self.options.range == 'selection' && updateAnnotations();
|
||||
} else if (key == 'out') {
|
||||
self.options.range == 'selection' && updateAnnotations();
|
||||
} else if (key == 'position') {
|
||||
if (self.options.range == 'position') {
|
||||
crossesPoint() && updateAnnotations();
|
||||
self.position = self.options.position;
|
||||
}
|
||||
} else if (key == 'range') {
|
||||
updateAnnotations();
|
||||
} else if (key == 'selected') {
|
||||
if (value === '') {
|
||||
self.editing = false;
|
||||
}
|
||||
if (value && self.options.collapsed) {
|
||||
self.$panel.options({animate: false});
|
||||
self.$panel.options({collapsed: false});
|
||||
self.$panel.options({animate: true});
|
||||
}
|
||||
self.$annotations.options({selected: value});
|
||||
} else if (key == 'sort') {
|
||||
self.sort = getSort();
|
||||
self.$annotations.options({sort: self.sort});
|
||||
showWarnings();
|
||||
} else if (key == 'users') {
|
||||
updateAnnotations();
|
||||
} else if (key == 'width') {
|
||||
if (self.widget) {
|
||||
self.$outer.options({width: self.options.width});
|
||||
self.$inner.options({width: self.options.width});
|
||||
self.$widget.options({width: self.options.width});
|
||||
}
|
||||
self.$annotations.options({
|
||||
width: self.options.type == 'text' ? self.options.width + 8 : self.options.width
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
addItem <f> addItem
|
||||
@*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue