Compare commits

...

2 commits

Author SHA1 Message Date
j
c2d35e615d don't move to annotation in point after adding annotation
creating an anntoation is async and might return after user has seeked
to another location or started playback again.

also: fix variable name: stayAtPosition->moveToPosition
2020-09-21 14:05:57 +02:00
j
396fac63c0 avoid error on blur 2020-09-21 14:02:57 +02:00
2 changed files with 10 additions and 10 deletions

View file

@ -325,7 +325,7 @@ Ox.AnnotationFolder = function(options, self) {
that.triggerEvent('add', {value: data.value || ''}); that.triggerEvent('add', {value: data.value || ''});
}, },
blur: function(data) { blur: function(data) {
if (data && data.id[0] == '_') { if (data && data.id && data.id[0] == '_') {
changeAnnotation(data); changeAnnotation(data);
that.triggerEvent('blur'); that.triggerEvent('blur');
} else { } else {

View file

@ -938,7 +938,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
that.triggerEvent('resizemap', data); that.triggerEvent('resizemap', data);
}, },
select: function(data) { select: function(data) {
selectAnnotation(data, true); selectAnnotation(data, !self.updating);
}, },
showentityinfo: function(data) { showentityinfo: function(data) {
that.triggerEvent('showentityinfo', data); that.triggerEvent('showentityinfo', data);
@ -1340,7 +1340,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
that.triggerEvent('annotationssize', {size: data.size}); that.triggerEvent('annotationssize', {size: data.size});
} }
function selectAnnotation(data, stayAtPosition) { function selectAnnotation(data, moveToPosition) {
if (Ox.isUndefined(data)) { if (Ox.isUndefined(data)) {
// doubleclick on small timeline // doubleclick on small timeline
data = getAnnotation(); data = getAnnotation();
@ -1351,13 +1351,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
// FIXME // FIXME
// self.editing = false; // self.editing = false;
if (data.id) { if (data.id) {
if (!stayAtPosition || ( var outOfRange = self.options.annotationsRange != 'position' && (
self.options.annotationsRange != 'position' && (
self.options.position < data['in'] self.options.position < data['in']
|| self.options.position > data.out || self.options.position > data.out
) )
) if (moveToPosition && outOfRange) {
) {
setPosition(data['in']); setPosition(data['in']);
// if annotationsRange is 'position', // if annotationsRange is 'position',
// this may cause a deselect // this may cause a deselect
@ -1717,6 +1715,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
(id, annotation) -> <o> update annotation with id (id, annotation) -> <o> update annotation with id
@*/ @*/
that.updateAnnotation = function(id, annotation) { that.updateAnnotation = function(id, annotation) {
self.updating = true
// called from editannotation callback // called from editannotation callback
// id might have changed if new annotation was created // id might have changed if new annotation was created
if (annotation.id) { if (annotation.id) {
@ -1730,6 +1729,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
self.annotations = getAnnotations(); self.annotations = getAnnotations();
setTimelineState(); setTimelineState();
} }
self.updating = false
}; };
/*@ /*@