1
0
Fork 0
forked from 0x2620/oxjs

some work towards making the edit annotations menu functional

This commit is contained in:
rlx 2012-02-16 11:35:03 +00:00
commit 8ab8d8d67a
5 changed files with 135 additions and 74 deletions

View file

@ -52,27 +52,6 @@ Ox.AnnotationFolder = function(options, self) {
self.widget = self.options.type == 'event' ? 'Calendar'
: self.options.type == 'place' ? 'Map' : '';
if (self.widget) {
self.$defineButton = Ox.Button({
disabled: !self.options.selected,
id: 'define',
style: 'symbol',
title: 'click',
tooltip: 'Define ' + Ox.toTitleCase(self.options.type),
type: 'image'
})
.bindEvent({
click: function() {
var item = Ox.getObjectById(self.options.items, self.options.selected);
that.triggerEvent('define', item.place ? {
id: item.place.id
} : {
name: item.value
});
}
});
}
self.$addButton = Ox.Button({
id: 'add',
style: 'symbol',
@ -99,10 +78,7 @@ Ox.AnnotationFolder = function(options, self) {
self.$panel = Ox.CollapsePanel({
collapsed: self.options.collapsed,
extras: Ox.merge(
self.widget ? [self.$defineButton] : [],
[self.options.editable ? self.$addButton : self.$infoButton]
),
extras: [self.options.editable ? self.$addButton : self.$infoButton],
size: 16,
title: self.options.title
})
@ -404,7 +380,7 @@ Ox.AnnotationFolder = function(options, self) {
function getSort() {
return ({
duration: ['+duration', '+in', '+value'],
duration: ['-duration', '+in', '+value'],
position: ['+in', '+duration', '+value'],
text: ['+value', '+in', '+duration']
})[self.options.sort];
@ -602,6 +578,10 @@ Ox.AnnotationFolder = function(options, self) {
return that;
};
that.removeItem = function() {
self.$annotations.removeItem();
};
that.selectItem = function(position) {
// selects the first (0) or last (-1) visible annotation
if (self.annotations.length) {