@ -18,6 +18,7 @@
var injectBubblesShow = null ;
var adjustHeight = BI . Combo . prototype . adjustHeight ;
var originalRender = BI . Widget . _renderEngine ;
var injectSearch = BI . Searcher . prototype . _assertPopupView ;
var injectCreate = BI . createWidget ;
@ -216,6 +217,10 @@
jQuery . event . fix = function ( e ) {
return correctEvent ( injectEventFix . call ( this , e ) ) ;
} ;
// Popovers
BI . Popovers = new BI . PopoverController ( { render : fixedContainer } ) ;
if ( BI . isIE ( ) ) {
BI . Combo . prototype . adjustHeight = function ( e ) {
adjustHeight . call ( this , e ) ;
@ -224,7 +229,17 @@
this . popupView . element [ 0 ] . style . left = ( parseInt ( this . popupView . element [ 0 ] . style . left ) * scale - document . body . scrollLeft ) + "px" ;
this . popupView . element [ 0 ] . style . top = ( parseInt ( this . popupView . element [ 0 ] . style . top ) * scale + transformY - document . body . scrollTop ) + "px" ;
} else {
var cBounds = this . popupView . element [ 0 ] . getBoundingClientRect ( ) ;
var pBounds = this . popupView . element [ 0 ] . parentElement . getBoundingClientRect ( ) ;
if ( parseInt ( cBounds . top ) >= parseInt ( pBounds . top ) && parseInt ( cBounds . left ) >= parseInt ( pBounds . left ) ) {
this . popupView . element [ 0 ] . style . top = ( parseInt ( pBounds . bottom ) + transformY - document . body . scrollTop ) + "px" ;
this . popupView . element [ 0 ] . style . left = ( parseInt ( pBounds . left ) + transformY - document . body . scrollTop ) + "px" ;
}
if ( parseInt ( cBounds . top ) >= parseInt ( pBounds . top ) && parseInt ( cBounds . left ) < parseInt ( pBounds . left ) ) {
this . popupView . element [ 0 ] . style . top = ( parseInt ( pBounds . bottom ) + transformY - document . body . scrollTop ) + "px" ;
this . popupView . element [ 0 ] . style . left = ( parseInt ( pBounds . left ) + transformY - document . body . scrollTop ) + "px" ;
}
}
this . popupView . element [ 0 ] . style . transform = "scale(" + scale + ")" ;
this . popupView . element [ 0 ] . style . transformOrigin = "top left" ;
@ -246,6 +261,26 @@
tooltip . element [ 0 ] . style . transform = "scale(" + scale + ")" ;
tooltip . element [ 0 ] . style . transformOrigin = "top left" ;
}
var tempAdd = BI . Popovers . add ;
BI . Popovers . add = function ( name , popover , options , context ) {
tempAdd . call ( this , name , popover , options , context ) ;
if ( this . floatContainer [ name ] . options . cls && this . floatContainer [ name ] . options . cls . includes ( "bi-popup-view" ) ) {
this . floatContainer [ name ] . element [ 0 ] . style . setProperty ( "position" , "absolute" , "important" ) ;
}
}
// Searcher
BI . Searcher . prototype . _assertPopupView = function ( ) {
injectSearch . call ( this ) ;
var self = this ;
if ( this . popupView ) {
BI . nextTick ( function ( ) {
self . popupView . element [ 0 ] . parentElement . style . transform = "scale(" + scale + ")" ;
self . popupView . element [ 0 ] . parentElement . style . transformOrigin = "left top" ;
} )
}
}
}
BI . createWidget = function ( ) {
@ -255,10 +290,6 @@
return injectCreate . apply ( this , arguments ) ;
} ;
// Popovers
BI . Popovers = new BI . PopoverController ( { render : fixedContainer } ) ;
//
BI . Widget . registerRenderEngine ( {
createElement : function ( widget ) {
if ( widget === "body" ) {
@ -291,6 +322,8 @@
BI . Popovers = new BI . PopoverController ( ) ;
BI . Widget . registerRenderEngine ( originalRender ) ;
BI . Searcher . prototype . _assertPopupView = injectSearch ;
document . body . onmousedown = null ;
window . removeEventListener ( 'resize' , updateScale ) ;
window . matchMedia && window . matchMedia ( 'screen and (min-resolution: 2dppx)' ) .