/* FWDMButtonToolTip */ (function (window){ var FWDMButtonToolTip = function( toolTipLabel_str, toolTipLabel2_str, pointerPosition_str, buttonToolTipTopPointer_str, buttonToolTipBottomPointer_str, buttonToolTipBackgroundColor, buttonToolTipFontColor ){ var _s = this; var prototype = FWDMButtonToolTip.prototype; _s.left_sdo = null; _s.middle_sdo = null; _s.right_sdo = null; _s.text_sdo = null; _s.pointer_sdo = null; _s.bottomPointer_str = buttonToolTipBottomPointer_str; _s.topPointer_str = buttonToolTipTopPointer_str; _s.pointerPosition_str = pointerPosition_str; _s.toolTipLabel_str = toolTipLabel_str; _s.toolTipLabel2_str = toolTipLabel2_str; _s.hideWithDelayId_do; _s.isMobile_bl = FWDMUtils.isMobile; _s.isShowed_bl = true; //##########################################// /* initialize _s */ //##########################################// _s.init = function(){ _s.getStyle().pointerEvents = 'none'; _s.setOverflow("visible"); _s.setWidth(200); _s.setupMainContainers(); _s.setLabel(_s.toolTipLabel_str); _s.hide(); }; //##########################################// /* setup main containers */ //##########################################// _s.setupMainContainers = function(){ var img; _s.text_sdo = new FWDMSimpleDisplayObject("div"); _s.text_sdo.screen.className = 'fwdm-button-tooltip'; _s.text_sdo.setBackfaceVisibility(); _s.text_sdo.setDisplay("inline-block"); _s.text_sdo.getStyle().fontFamily = "Arial"; _s.text_sdo.getStyle().fontSize= "12px"; _s.text_sdo.getStyle().whiteSpace = 'nowrap'; _s.text_sdo.getStyle().boxSizing = 'border-box'; _s.text_sdo.getStyle().backgroundColor = buttonToolTipBackgroundColor; _s.text_sdo.getStyle().color = buttonToolTipFontColor; _s.addChild(_s.text_sdo); _s.pointerHolder_do = new FWDMDisplayObject("div"); _s.pointerHolder_do.setOverflow('visible'); _s.addChild(_s.pointerHolder_do); _s.pointer_sdo = new FWDMSimpleDisplayObject("div"); _s.pointer_sdo.hasTransform3d_bl = _s.pointer_sdo.hasTransform2d_bl = false; _s.pointer_sdo.setY(0); if(_s.pointerPosition_str == FWDMController.POSITION_BOTTOM){ _s.pointer_sdo.screen.className = 'fwdm-button-tooltip-pointer fwdm-pointer-down'; }else{ _s.pointer_sdo.screen.className = 'fwdm-button-tooltip-pointer fwdm-pointer-up'; } _s.pointer_sdo.setBkColor(_s.dClr); _s.pointer_sdo.getStyle().transform = 'rotate(45deg)'; _s.pointer_sdo.getStyle().backgroundColor = buttonToolTipBackgroundColor; _s.pointer_sdo.setWidth(8); _s.pointer_sdo.setHeight(8); _s.pointer_sdo.screen.style.position = 'absolute'; _s.addChild(_s.pointer_sdo); }; //##########################################// /* set label */ //##########################################// _s.setLabel = function(label){ if(_s == null) return; _s.text_sdo.setInnerHTML(label); setTimeout(function(){ _s.setLabelAndPosWithDealy(); },61); setTimeout(function(){ _s.setLabelAndPosWithDealy(); },120); }; _s.setLabelAndPosWithDealy = function(){ if(_s == null) return; _s.pointerWidth = _s.pointer_sdo.getWidth(); _s.pointerHeight = _s.pointer_sdo.getHeight(); _s.totalWidth = _s.text_sdo.screen.offsetWidth; _s.totalHeight = _s.text_sdo.getHeight() + _s.pointerHeight; _s.positionPointer(0); } _s.positionPointer = function(offsetX){ var finalX; var finalY; if(!offsetX) offsetX = 0; finalX = parseInt((_s.totalWidth - _s.pointerWidth)/2) + offsetX; if(_s.pointerPosition_str == FWDMController.POSITION_BOTTOM){ finalY = _s.totalHeight - _s.pointerHeight - _s.pointerHeight/2; _s.text_sdo.screen.className = 'fwdm-button-tooltip fwdm-pointer-down'; }else{ finalY = - _s.pointerHeight + _s.pointerHeight/2; _s.text_sdo.screen.className = 'fwdm-button-tooltip fwdm-pointer-up'; } _s.pointer_sdo.setX(finalX); _s.pointer_sdo.setY(finalY); }; //##########################################// /* show / hide*/ //##########################################// _s.show = function(){ if(_s.isShowed_bl) return; clearInterval(_s.hideWithDelayId_do); _s.positionPointer(); FWDAnimation.killTweensOf(_s); FWDAnimation.to(_s, .4, {alpha:1, delay:.1, ease:Quart.easeOut}); _s.isShowed_bl = true; }; _s.hide = function(){ if(!_s.isShowed_bl) return; FWDAnimation.killTweensOf(_s); _s.setX(-5000); _s.setAlpha(0); _s.isShowed_bl = false; }; //##############################// /* destroy */ //##############################// _s.destroy = function(){ FWDAnimation.killTweensOf(_s); _s.text_sdo.destroy(); _s.pointer_sdo.destroy(); _s.fontColor_str = null; _s.bottomPointer_str = null; _s.topPointer_str = null; _s.pointerPosition_str = null; _s.toolTipLabel_str = null; _s.toolTipLabel2_str = null; _s.text_sdo = null; _s.pointer_sdo = null; toolTipLabel_str = null; toolTipLabel2_str = null; pointerPosition_str = null; buttonToolTipTopPointer_str = null; buttonToolTipBottomPointer_str = null; _s.setInnerHTML(""); prototype.destroy(); _s = null; prototype = null; FWDMButtonToolTip.prototype = null; }; _s.init(); }; /* set prototype */ FWDMButtonToolTip.setPrototype = function(){ FWDMButtonToolTip.prototype = null; FWDMButtonToolTip.prototype = new FWDMDisplayObject("div"); }; FWDMButtonToolTip.CLICK = "onClick"; FWDMButtonToolTip.MOUSE_DOWN = "onMouseDown"; FWDMButtonToolTip.prototype = null; window.FWDMButtonToolTip = FWDMButtonToolTip; }(window));