Browse Source

DESIGN-110 feat: 反馈-tooltip

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

41
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"); this.text = BI.createWidget({
if (texts.length > 1) { type: "bi.label",
BI.createWidget({ element: this,
type: "bi.vertical", textAlign: o.textAlign,
element: this, whiteSpace: "normal",
hgap: this._const.hgap, text: o.text,
items: BI.map(texts, function (i, text) { textHeight: 20,
return { hgap: this._const.hgap,
type: "bi.label", vgap: this._const.vgap,
textAlign: o.textAlign, });
whiteSpace: "normal",
text: text,
textHeight: 18
};
})
});
} else {
this.text = BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign,
whiteSpace: "normal",
text: o.text,
textHeight: 18,
hgap: this._const.hgap
});
}
}, },
setWidth: function (width) { setWidth: function (width) {

Loading…
Cancel
Save