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 var width = $item.width(), // fixme: don't lookup in DOM
height = $item.height(); height = $item.height();
$item $item
.height(height + 8) .height(height + 8 + 16)
.empty() .empty()
.addClass('OxEdit'); .addClass('OxEdit');
$input = new Ox.Input({
height: height, new Ox.Element()
style: 'square', .append($input = new Ox.Input({
type: 'textarea', height: height,
value: item.value, style: 'square',
width: width + 6 type: 'textarea',
}) value: item.value,
.bind({ width: width + 6
mousedown: function(e) { })
// keep mousedown from reaching list .bind({
e.stopPropagation(); mousedown: function(e) {
} // keep mousedown from reaching list
}) e.stopPropagation();
.bindEvent({ }
blur: submit, })
}) )
.appendTo($item.$element) .append(new Ox.Element()
.gainFocus(); .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() { function submit() {
item.value = $input.value(); item.value = $input.value();
//$input.loseFocus().remove(); //$input.loseFocus().remove();
@ -12166,6 +12195,8 @@ requires
setPoints(); setPoints();
} }
function updateAnnotation(event, data) { function updateAnnotation(event, data) {
data.in = self.options.points[0];
data.out = self.options.points[1];
that.triggerEvent('updateAnnotation', data); that.triggerEvent('updateAnnotation', data);
} }