dont fail if previously selected id was removed

This commit is contained in:
j 2012-03-13 13:26:13 +01:00
parent 9e7a639ada
commit 3551e73249

View file

@ -156,7 +156,7 @@ Ox.AnnotationPanel = function(options, self) {
}) })
); );
self.options.selected && scrollToSelected( self.options.selected && getFolder(self.options.selected) && scrollToSelected(
getFolder(self.options.selected).options('type') getFolder(self.options.selected).options('type')
); );
@ -382,7 +382,7 @@ Ox.AnnotationPanel = function(options, self) {
function scrollToSelected(type) { function scrollToSelected(type) {
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,
itemBottom = itemTop + itemHeight, itemBottom = itemTop + itemHeight,
height = self.$folders.height(), height = self.$folders.height(),
scrollTop = self.$folders.scrollTop(), scrollTop = self.$folders.scrollTop(),