cancel/save button for annotations

This commit is contained in:
j 2011-02-21 18:31:02 +01:00
parent fb6d793772
commit e698fda8c2

View file

@ -7694,27 +7694,56 @@ requires
var width = $item.width(), // fixme: don't lookup in DOM
height = $item.height();
$item
.height(height + 8)
.height(height + 8 + 16)
.empty()
.addClass('OxEdit');
$input = new Ox.Input({
height: height,
style: 'square',
type: 'textarea',
value: item.value,
width: width + 6
})
.bind({
mousedown: function(e) {
// keep mousedown from reaching list
e.stopPropagation();
}
})
.bindEvent({
blur: submit,
})
.appendTo($item.$element)
.gainFocus();
new Ox.Element()
.append($input = new Ox.Input({
height: height,
style: 'square',
type: 'textarea',
value: item.value,
width: width + 6
})
.bind({
mousedown: function(e) {
// keep mousedown from reaching list
e.stopPropagation();
}
})
)
.append(new Ox.Element()
.append(
new Ox.Button({type: 'text', title: 'Cancel'})
.css('width', '42%')
.bindEvent({
'click': cancel
})
)
.append(
new Ox.Button({type: 'text', title: 'Save'})
.css('width', '42%')
.bindEvent({
'click': submit
})
).css({
'margin-top': height-8,
'height': '16px',
'text-align': 'right',
})
)
.appendTo($item.$element);
//gain focus async, otherwise enter gets
//passed on to input and removes all data
setTimeout(function() {
$input.gainFocus();
$input.focus();
});
function cancel() {
$item.options('data', item);
//fixme: trigger event to reset i/o points
}
function submit() {
item.value = $input.value();
//$input.loseFocus().remove();
@ -12166,6 +12195,8 @@ requires
setPoints();
}
function updateAnnotation(event, data) {
data.in = self.options.points[0];
data.out = self.options.points[1];
that.triggerEvent('updateAnnotation', data);
}