提交 e87e763f 编写于 作者: K kener

代码优化

上级 9fa600b1
......@@ -114,6 +114,9 @@ option = {
xAxis : {
data : ['周一','周二','周三','周四','周五','周六','周日']
},
yAxis : {
type : 'value'
},
series : [
{
name:'坐标轴触发1',
......
......@@ -266,9 +266,7 @@ define(function (require) {
}
},
buildMark : function (
serie, seriesIndex, component, markCoordParams, attachStyle
) {
buildMark : function (serie, seriesIndex, component, markCoordParams, attachStyle) {
if (this.selectedMap[serie.name]) {
serie.markPoint && this._buildMarkPoint(
serie, seriesIndex, component, markCoordParams, attachStyle
......@@ -279,9 +277,7 @@ define(function (require) {
}
},
_buildMarkPoint : function (
serie, seriesIndex, component, markCoordParams, attachStyle
) {
_buildMarkPoint : function (serie, seriesIndex, component, markCoordParams, attachStyle) {
var _zlevelBase = this.getZlevelBase();
var mpData;
var pos;
......@@ -306,9 +302,7 @@ define(function (require) {
}
}
var shapeList = this._markPoint(
serie, seriesIndex, markPoint, component
);
var shapeList = this._markPoint(serie, seriesIndex, markPoint, component);
for (var i = 0, l = shapeList.length; i < l; i++) {
shapeList[i].zlevel = _zlevelBase + 1;
......@@ -334,9 +328,7 @@ define(function (require) {
}
},
_buildMarkLine : function (
serie, seriesIndex, component, markCoordParams, attachStyle
) {
_buildMarkLine : function (serie, seriesIndex, component, markCoordParams, attachStyle) {
var _zlevelBase = this.getZlevelBase();
var mlData;
var pos;
......
......@@ -51,6 +51,9 @@ define(function (require) {
buildPath : function (ctx, style) {
var pointList = style.pointList;
var len = pointList.length;
if (len == 0) {
return;
}
var subSize = 10000;
var subSetLength = Math.ceil(len / subSize);
var sub;
......@@ -117,10 +120,24 @@ define(function (require) {
* @param {Object} style
*/
getRect : function (style) {
return polygonInstance.getRect(style);
return style.__rect || polygonInstance.getRect(style);
},
isCover : function () {
isCover : function (x, y) {
// 快速预判并保留判断矩形
var rect = this.style.__rect;
if (!rect) {
rect = this.style.__rect = this.getRect(this.style);
}
if (x >= rect.x
&& x <= (rect.x + rect.width)
&& y >= rect.y
&& y <= (rect.y + rect.height)
) {
// 矩形内
return true;
}
return false;
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册