@antv/f6
Version:
A Mobile Graph Visualization Framework in JavaScript
43 lines • 909 B
JavaScript
export default {
getDefaultCfg: function getDefaultCfg() {
return {
item: 'node',
offset: 12,
formatText: function formatText(model) {
return model.label;
}
};
},
getEvents: function getEvents() {
return {
'node:press': 'onPress',
actionend: 'onPressEnd'
};
},
onPress: function onPress(e) {
var item = e.item;
this.currentTarget = item;
this.showTooltip(e);
this.graph.emit('tooltipchange', {
item: e.item,
action: 'show'
});
},
onPressEnd: function onPressEnd(e) {
if (!this.shouldEnd(e)) {
return;
}
this.hideTooltip();
this.graph.emit('tooltipchange', {
item: this.currentTarget,
action: 'hide'
});
this.currentTarget = null;
},
showTooltip: function showTooltip(e) {
// 绘制tip
},
hideTooltip: function hideTooltip() {
// 隐藏tip
}
};