changes in video editor and list map
This commit is contained in:
parent
76466e7eeb
commit
353fce1f14
5 changed files with 41 additions and 26 deletions
|
@ -192,7 +192,7 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
that.blurItem();
|
that.blurItem();
|
||||||
}
|
}
|
||||||
Ox.print('AE SELECT ITEM', self.options.selected, self.selected);
|
Ox.print('SELECT ITEM', self.options.selected, self.selected);
|
||||||
that.find('.OxSelected').removeClass('OxSelected');
|
that.find('.OxSelected').removeClass('OxSelected');
|
||||||
self.selected > -1 && self.$items[self.selected].addClass('OxSelected');
|
self.selected > -1 && self.$items[self.selected].addClass('OxSelected');
|
||||||
triggerSelectEvent();
|
triggerSelectEvent();
|
||||||
|
@ -233,15 +233,16 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
position = $element.data('position');
|
position = $element.data('position');
|
||||||
if (!$target.is('.OxInput')) {
|
if (!$target.is('.OxInput')) {
|
||||||
if ($element.length) {
|
if ($element.length) {
|
||||||
if (!$element.is('.OxSelected')) {
|
// if clicked on an element
|
||||||
|
if (position != self.selected) {
|
||||||
// select another item
|
// select another item
|
||||||
selectItem(
|
selectItem(position);
|
||||||
e.metaKey && position == self.selected
|
} else if (e.metaKey) {
|
||||||
? '' : position
|
// or deselect current item
|
||||||
);
|
selectNone();
|
||||||
}
|
}
|
||||||
} else if (!self.blurred) {
|
} else if (!self.blurred) {
|
||||||
// if there wasn't an active input element
|
// otherwise, if there wasn't an active input element
|
||||||
if (self.editing) {
|
if (self.editing) {
|
||||||
// blur if still in editing mode
|
// blur if still in editing mode
|
||||||
that.blurItem();
|
that.blurItem();
|
||||||
|
|
|
@ -69,7 +69,7 @@ Ox.ListMap = function(options, self) {
|
||||||
title: 'Id',
|
title: 'Id',
|
||||||
unique: true,
|
unique: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
width: 64
|
width: 32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
format: function(value, data) {
|
format: function(value, data) {
|
||||||
|
@ -326,7 +326,8 @@ Ox.ListMap = function(options, self) {
|
||||||
columnsVisible: true,
|
columnsVisible: true,
|
||||||
//items: Ox.clone(self.options.places),
|
//items: Ox.clone(self.options.places),
|
||||||
items: self.options.places,
|
items: self.options.places,
|
||||||
keys: ['area', 'geoname'], // needed for icon and flag
|
// area needed for icon, geoname needed for flag
|
||||||
|
keys: ['area', 'geoname', 'matches'],
|
||||||
max: 1,
|
max: 1,
|
||||||
min: 0,
|
min: 0,
|
||||||
pageLength: self.options.pageLength,
|
pageLength: self.options.pageLength,
|
||||||
|
@ -649,7 +650,7 @@ Ox.ListMap = function(options, self) {
|
||||||
.appendTo(self.$placeStatusbar);
|
.appendTo(self.$placeStatusbar);
|
||||||
|
|
||||||
self.$addPlaceButton = Ox.Button({
|
self.$addPlaceButton = Ox.Button({
|
||||||
tooltip: 'Add Place',
|
title: 'Add Place',
|
||||||
width: 90
|
width: 90
|
||||||
})
|
})
|
||||||
.css({float: 'right', margin: '4px'})
|
.css({float: 'right', margin: '4px'})
|
||||||
|
@ -833,8 +834,8 @@ Ox.ListMap = function(options, self) {
|
||||||
var values = {
|
var values = {
|
||||||
id: self.selectedPlace,
|
id: self.selectedPlace,
|
||||||
alternativeNames: [], geoname: '', type: '',
|
alternativeNames: [], geoname: '', type: '',
|
||||||
latitude: null, longitude: null,
|
lat: null, lng: null,
|
||||||
south: null, west: null, north: null, east: null
|
south: null, west: null, north: null, east: null, area: null
|
||||||
};
|
};
|
||||||
self.$definePlaceButton.options({disabled: true, title: 'Clearing...'});
|
self.$definePlaceButton.options({disabled: true, title: 'Clearing...'});
|
||||||
self.options.editPlace(values, function() {
|
self.options.editPlace(values, function() {
|
||||||
|
@ -848,7 +849,7 @@ Ox.ListMap = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function definePlace() {
|
function definePlace() {
|
||||||
self.$map.newPlace();
|
self.$map.newPlace(); // this will call selectPlace, then editPlace
|
||||||
self.$definePlaceButton.options({title: 'Clear Place'})
|
self.$definePlaceButton.options({title: 'Clear Place'})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,6 +918,9 @@ Ox.ListMap = function(options, self) {
|
||||||
self.$addPlaceButton.options({disabled: true, title: 'Removing...'})
|
self.$addPlaceButton.options({disabled: true, title: 'Removing...'})
|
||||||
self.options.removePlace({id: self.selectedPlace}, function() {
|
self.options.removePlace({id: self.selectedPlace}, function() {
|
||||||
self.$list.options({selected: []}).reloadList(true);
|
self.$list.options({selected: []}).reloadList(true);
|
||||||
|
self.options.mode == 'define' && self.$definePlaceButton.options({
|
||||||
|
disabled: true
|
||||||
|
});
|
||||||
self.$addPlaceButton.options({disabled: false, title: 'Add Place'})
|
self.$addPlaceButton.options({disabled: false, title: 'Add Place'})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -946,6 +950,7 @@ Ox.ListMap = function(options, self) {
|
||||||
title: 'Define Place'
|
title: 'Define Place'
|
||||||
}).show();
|
}).show();
|
||||||
self.$addPlaceButton.options({
|
self.$addPlaceButton.options({
|
||||||
|
disabled: self.$list.value(self.options.selected, 'matches') > 0,
|
||||||
title: 'Remove Place'
|
title: 'Remove Place'
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
@ -960,14 +965,19 @@ Ox.ListMap = function(options, self) {
|
||||||
isUndefined = !!self.options.selected
|
isUndefined = !!self.options.selected
|
||||||
&& !self.$list.value(self.options.selected, 'type');
|
&& !self.$list.value(self.options.selected, 'type');
|
||||||
Ox.print('isResult', isResult, 'isUndefined', isUndefined, self.options.selected)
|
Ox.print('isResult', isResult, 'isUndefined', isUndefined, self.options.selected)
|
||||||
if (!isUndefined) {
|
if (!(isUndefined && !place.id)) {
|
||||||
|
// if isUndefined && !place.id, then we're handling the
|
||||||
|
// map deselect, which we don't want to pass to the list
|
||||||
self.$list.options({
|
self.$list.options({
|
||||||
selected: place.id && !isResult ? [place.id] : []
|
selected: place.id && !isResult ? [place.id] : []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (place.id) {
|
if (place.id) {
|
||||||
if (isResult && isUndefined) {
|
if (isResult && isUndefined) {
|
||||||
place.name = self.$list.value(self.selectedPlace, 'name');
|
self.selectedPlace = self.options.selected;
|
||||||
|
place.id = self.options.selected;
|
||||||
|
place.name = self.$list.value(self.options.selected, 'name');
|
||||||
|
Ox.print('PLACE::::::', place)
|
||||||
}
|
}
|
||||||
self.options.mode == 'define' && self.$findPlaceButton.hide();
|
self.options.mode == 'define' && self.$findPlaceButton.hide();
|
||||||
self.$placeFlag.attr({
|
self.$placeFlag.attr({
|
||||||
|
@ -977,19 +987,21 @@ Ox.ListMap = function(options, self) {
|
||||||
self.$placeTitle.show();
|
self.$placeTitle.show();
|
||||||
self.$placeForm.values(place).show();
|
self.$placeForm.values(place).show();
|
||||||
self.$areaKmInput.value(Ox.formatArea(place.area));
|
self.$areaKmInput.value(Ox.formatArea(place.area));
|
||||||
updateMatches();
|
self.$matchesInput.value(place.matches);
|
||||||
|
//updateMatches();
|
||||||
self.options.mode == 'define' && self.$definePlaceButton.options({
|
self.options.mode == 'define' && self.$definePlaceButton.options({
|
||||||
title: isUndefined && !isResult ? 'Define Place' : 'Clear Place'
|
title: isUndefined && !isResult ? 'Define Place' : 'Clear Place'
|
||||||
}).show();
|
}).show();
|
||||||
self.$addPlaceButton.options({
|
self.$addPlaceButton.options({
|
||||||
|
disabled: self.options.mode == 'define' && place.matches > 0,
|
||||||
title: isResult ? 'Add Place' : 'Remove Place'
|
title: isResult ? 'Add Place' : 'Remove Place'
|
||||||
}).show();
|
}).show();
|
||||||
if (isResult && isUndefined) {
|
if (isResult && isUndefined) {
|
||||||
Ox.print('???? s.o.s s.sP', self.options.selected, self.selectedPlace)
|
self.$map.addPlace(place);
|
||||||
self.selectedPlace = self.options.selected;
|
self.$addPlaceButton.options({title: 'Remove Place'});
|
||||||
editPlace([
|
editPlace([
|
||||||
'geoname', 'type',
|
'geoname', 'type',
|
||||||
'latitude', 'longitude',
|
'lat', 'lng',
|
||||||
'south', 'west', 'north', 'east', 'area'
|
'south', 'west', 'north', 'east', 'area'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,6 +530,7 @@ Ox.Map = function(options, self) {
|
||||||
var place = getSelectedPlace(),
|
var place = getSelectedPlace(),
|
||||||
country = Ox.getCountryByGeoname(place.geoname);
|
country = Ox.getCountryByGeoname(place.geoname);
|
||||||
Ox.extend(place, data);
|
Ox.extend(place, data);
|
||||||
|
Ox.print('addPlaceToPlaces, place name:', place.name)
|
||||||
self.options.selected = place.id;
|
self.options.selected = place.id;
|
||||||
place.countryCode = country ? country.code : '';
|
place.countryCode = country ? country.code : '';
|
||||||
Ox.Log('Map', 'addP2P', data, place);
|
Ox.Log('Map', 'addP2P', data, place);
|
||||||
|
@ -1132,6 +1133,7 @@ Ox.Map = function(options, self) {
|
||||||
self.places.splice(Ox.getIndexById(self.places, place.id), 1);
|
self.places.splice(Ox.getIndexById(self.places, place.id), 1);
|
||||||
self.resultPlace && self.resultPlace.remove();
|
self.resultPlace && self.resultPlace.remove();
|
||||||
self.resultPlace = place;
|
self.resultPlace = place;
|
||||||
|
Ox.print('removed place, place is now', place);
|
||||||
place.marker.update();
|
place.marker.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,7 +1539,7 @@ Ox.Map = function(options, self) {
|
||||||
|
|
||||||
that.value = function(id, key, value) {
|
that.value = function(id, key, value) {
|
||||||
// fixme: should be like the corresponding List/TextList/etc value function
|
// fixme: should be like the corresponding List/TextList/etc value function
|
||||||
Ox.Log('Map', 'Map.value', id, key, value)
|
Ox.print('Map', 'Map.value', id, key, value)
|
||||||
getPlaceById(id).options(key, value);
|
getPlaceById(id).options(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,7 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollToSelected(type) {
|
function scrollToSelected(type) {
|
||||||
try {
|
//try {
|
||||||
Ox.print('scrollToSelected $item', that.find('.OxEditableElement.OxSelected'))
|
|
||||||
var $item = that.find('.OxEditableElement.OxSelected'),
|
var $item = that.find('.OxEditableElement.OxSelected'),
|
||||||
itemHeight = $item.height() + (type == 'text' ? 8 : 0),
|
itemHeight = $item.height() + (type == 'text' ? 8 : 0),
|
||||||
itemTop = $item.offset().top,
|
itemTop = $item.offset().top,
|
||||||
|
@ -280,9 +279,9 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
scrollTop: scrollTop + 'px'
|
scrollTop: scrollTop + 'px'
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
//} catch(e) {
|
||||||
Ox.print('THIS SHOULD NOT HAPPEN');
|
// Ox.print('THIS SHOULD NOT HAPPEN');
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAnnotation(data, index) {
|
function selectAnnotation(data, index) {
|
||||||
|
|
|
@ -692,7 +692,8 @@ Ox.VideoEditor = function(options, self) {
|
||||||
// we need a timeout so that a chained bindEvent
|
// we need a timeout so that a chained bindEvent
|
||||||
// actually catches the event
|
// actually catches the event
|
||||||
self.options.find && setTimeout(function() {
|
self.options.find && setTimeout(function() {
|
||||||
submitFindInput(self.options.find, true);
|
// only submit if no annotation is selected
|
||||||
|
submitFindInput(self.options.find, !self.options.selected);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
function addAnnotation(layer) {
|
function addAnnotation(layer) {
|
||||||
|
|
Loading…
Reference in a new issue