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,10 +7694,12 @@ 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({
new Ox.Element()
.append($input = new Ox.Input({
height: height,
style: 'square',
type: 'textarea',
@ -7710,11 +7712,38 @@ requires
e.stopPropagation();
}
})
)
.append(new Ox.Element()
.append(
new Ox.Button({type: 'text', title: 'Cancel'})
.css('width', '42%')
.bindEvent({
blur: submit,
'click': cancel
})
.appendTo($item.$element)
.gainFocus();
)
.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);
}