// ======================================================================== // SproutCore // copyright 2006-2007 Sprout Systems, Inc. // ======================================================================== require('panes/overlay') ; SC.PICKER_PANE = 'picker'; SC.PickerPaneView = SC.OverlayPaneView.extend({ emptyElement: '
', layer: 300, isModal: false, // The ideal position for a picker pane is just below the anchor that // triggered it. Find that ideal position, then call adjustPosition. positionPane: function() { var anchor = this.anchorView ; var picker = this.containerView ; var origin ; // usually an anchorView will be passed. The ideal position to appear is // just below the anchorView. If that is not possible, fitToScreen will // take care of that. if (anchor) { origin = picker.convertFrameFromView(anchor.get('frame'), anchor) ; origin.y += origin.height ; origin = this.fitPositionToScreen(origin, picker, anchor) ; // if no anchor view has been set for some reason, just center. } else { var wsize = SC.window.get('size') ; var psize = picker.get('size') ; origin.x = (wsize.width - psize.width) / 2 ; origin.y = (wsize.height - psize.height) / 2 ; } picker.set('origin',origin) ; } }) ;