forked from 0x2620/oxjs
- find in layers
- change upadteAnnotation call to allow id updates
This commit is contained in:
parent
e8b1362309
commit
fd96423266
6 changed files with 81 additions and 38 deletions
|
|
@ -25,6 +25,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
clickLink: null,
|
||||
collapsed: false,
|
||||
editable: false,
|
||||
highlight: null,
|
||||
id: '',
|
||||
'in': 0,
|
||||
item: '',
|
||||
|
|
@ -205,6 +206,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
self.$annotations = Ox.ArrayEditable({
|
||||
clickLink: self.options.clickLink,
|
||||
editable: self.options.editable,
|
||||
highlight: self.highlight,
|
||||
items: self.annotations,
|
||||
placeholder: 'No ' + self.options.title,
|
||||
selected: self.options.selected,
|
||||
|
|
@ -479,6 +481,9 @@ 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;
|
||||
|
|
@ -528,7 +533,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
addItem <f> addItem
|
||||
@*/
|
||||
that.addItem = function(item) {
|
||||
Ox.print('FOLDER ADD ITEM', item)
|
||||
Ox.Log('AF', 'FOLDER ADD ITEM', item)
|
||||
var pos = 0;
|
||||
self.options.items.splice(pos, 0, item);
|
||||
self.$panel.options({collapsed: false});
|
||||
|
|
@ -566,12 +571,13 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
};
|
||||
*/
|
||||
|
||||
that.updateItem = function(data) {
|
||||
var item = Ox.getObjectById(self.options.items, data.id);
|
||||
that.updateItem = function(id, data) {
|
||||
var item = Ox.getObjectById(self.options.items, id);
|
||||
Ox.forEach(data, function(value, key) {
|
||||
item[key] = value;
|
||||
});
|
||||
updateAnnotations();
|
||||
self.options.selected = item.id;
|
||||
self.$annotations.options({selected: self.options.selected});
|
||||
if (self.widget && item[self.options.type]) {
|
||||
// if updating has made the item match
|
||||
// an event or place, then select it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue