提交 8f034808 编写于 作者: P pah100

tweak handle tooltip position

上级 d6263d8b
......@@ -353,7 +353,7 @@ define(function(require) {
currTrigger: 'handle',
x: trans.cursorPoint[0],
y: trans.cursorPoint[1],
tooltipOption: this.getHandleTooltipOption(axisModel, axisPointerModel),
tooltipOption: trans.tooltipOption,
highDownKey: 'axisPointerHandle'
};
var axis = axisModel.axis;
......@@ -399,16 +399,6 @@ define(function(require) {
*/
updateHandleTransform: null,
/**
* @protected
* @return {Object}
*/
getHandleTooltipOption: function (axisModel, axisPointerModel) {
return {
verticalAlign: 'middle'
};
},
/**
* @private
*/
......
......@@ -52,17 +52,27 @@ define(function(require) {
var axis = axisModel.axis;
var grid = axis.grid;
var axisExtent = axis.getGlobalExtent(true);
var currPosition = transform.position;
var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
var dimIndex = axis.dim === 'x' ? 0 : 1;
var currPosition = transform.position;
currPosition[dimIndex] += delta[dimIndex];
currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]);
currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]);
var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2;
var cursorPoint = [cursorOtherValue, cursorOtherValue];
cursorPoint[dimIndex] = currPosition[dimIndex];
return {position: currPosition, rotation: transform.rotation, cursorPoint: cursorPoint};
// Make tooltip do not overlap axisPointer and in the middle of the grid.
var tooltipOptions = [{verticalAlign: 'middle'}, {align: 'center'}];
return {
position: currPosition,
rotation: transform.rotation,
cursorPoint: cursorPoint,
tooltipOption: tooltipOptions[dimIndex]
};
}
});
......
......@@ -63,7 +63,14 @@ define(function(require) {
var cursorPoint = [cursorOtherValue, cursorOtherValue];
cursorPoint[dimIndex] = currPosition[dimIndex];
return {position: currPosition, rotation: transform.rotation, cursorPoint: cursorPoint};
return {
position: currPosition,
rotation: transform.rotation,
cursorPoint: cursorPoint,
tooltipOption: {
verticalAlign: 'middle'
}
};
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册