Browse Source

DESIGN-110 feat: 反馈-tooltip

es6
zsmj 3 years ago
parent
commit
8900a40f9d
  1. 27
      src/base/single/tip/tip.tooltip.js

27
src/base/single/tip/tip.tooltip.js

@ -7,8 +7,8 @@
*/ */
BI.Tooltip = BI.inherit(BI.Tip, { BI.Tooltip = BI.inherit(BI.Tip, {
_const: { _const: {
hgap: 5, hgap: 8,
vgap: 3 vgap: 4
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -39,33 +39,16 @@ BI.Tooltip = BI.inherit(BI.Tip, {
mousemove: fn mousemove: fn
}); });
var texts = (o.text + "").split("\n");
if (texts.length > 1) {
BI.createWidget({
type: "bi.vertical",
element: this,
hgap: this._const.hgap,
items: BI.map(texts, function (i, text) {
return {
type: "bi.label",
textAlign: o.textAlign,
whiteSpace: "normal",
text: text,
textHeight: 18
};
})
});
} else {
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
element: this, element: this,
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",
text: o.text, text: o.text,
textHeight: 18, textHeight: 20,
hgap: this._const.hgap hgap: this._const.hgap,
vgap: this._const.vgap,
}); });
}
}, },
setWidth: function (width) { setWidth: function (width) {

Loading…
Cancel
Save