[incubator-echarts] 01/03: tweak the hover style save logic.

2019-08-18 Thread shenyi
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 952b196cfc7ef07941b3eb15af9f6704ea64a4d2
Author: sushuang 
AuthorDate: Thu Aug 15 16:45:31 2019 +0800

tweak the hover style save logic.
---
 src/util/graphic.js  | 94 +---
 test/tree-basic.html | 25 +++---
 2 files changed, 59 insertions(+), 60 deletions(-)

diff --git a/src/util/graphic.js b/src/util/graphic.js
index 8795440..9552e2f 100644
--- a/src/util/graphic.js
+++ b/src/util/graphic.js
@@ -51,6 +51,13 @@ var EMPTY_OBJ = {};
 
 export var Z2_EMPHASIS_LIFT = 1;
 
+// key: label model property nane, value: style property name.
+export var CACHED_LABEL_STYLE_PROPERTIES = {
+color: 'textFill',
+textBorderColor: 'textStroke',
+textBorderWidth: 'textStrokeWidth'
+};
+
 var EMPHASIS = 'emphasis';
 var NORMAL = 'normal';
 
@@ -921,13 +928,6 @@ function getAutoColor(color, opt) {
 return color !== 'auto' ? color : (opt && opt.autoColor) ? opt.autoColor : 
null;
 }
 
-// key: label model property nane, value: style property name.
-export var CACHED_LABEL_STYLE_PROPERTIES = {
-color: 'textFill',
-textBorderColor: 'textStroke',
-textBorderWidth: 'textStrokeWidth'
-};
-
 /**
  * Give some default value to the input `textStyle` object, based on the 
current settings
  * in this `textStyle` object.
@@ -946,52 +946,49 @@ export var CACHED_LABEL_STYLE_PROPERTIES = {
  * does, `rollbackDefaultTextStyle` is not needed to be called).
  */
 function applyDefaultTextStyle(textStyle) {
-var opt = textStyle.insideRollbackOpt;
-
-// Only `insideRollbackOpt` created (in `setTextStyleCommon`),
-// applyDefaultTextStyle works.
-if (!opt || textStyle.textFill != null) {
-return;
-}
-
-var useInsideStyle = opt.useInsideStyle;
 var textPosition = textStyle.textPosition;
+var opt = textStyle.insideRollbackOpt;
 var insideRollback;
-var autoColor = opt.autoColor;
-
-if (useInsideStyle !== false
-&& (useInsideStyle === true
-|| (opt.isRectText
-&& textPosition
-// textPosition can be [10, 30]
-&& typeof textPosition === 'string'
-&& textPosition.indexOf('inside') >= 0
-)
-)
-) {
-// If intend to cache more properties here, modify the
-// `CACHED_LABEL_STYLE_PROPERTIES`.
-insideRollback = {
-textFill: null,
-textStroke: textStyle.textStroke,
-textStrokeWidth: textStyle.textStrokeWidth
-};
-textStyle.textFill = '#fff';
-// Consider text with #fff overflow its container.
-if (textStyle.textStroke == null) {
-textStyle.textStroke = autoColor;
-textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 
2);
+
+if (opt) {
+var autoColor = opt.autoColor;
+var isRectText = opt.isRectText;
+var useInsideStyle = opt.useInsideStyle;
+
+var useInsideStyleCache = useInsideStyle !== false
+&& (useInsideStyle === true
+|| (isRectText
+&& textPosition
+// textPosition can be [10, 30]
+&& typeof textPosition === 'string'
+&& textPosition.indexOf('inside') >= 0
+)
+);
+var useAutoColorCache = !useInsideStyleCache && autoColor != null;
+
+// All of the props declared in `CACHED_LABEL_STYLE_PROPERTIES` are to 
be cached.
+if (useInsideStyleCache || useAutoColorCache) {
+insideRollback = {
+textFill: textStyle.textFill,
+textStroke: textStyle.textStroke,
+textStrokeWidth: textStyle.textStrokeWidth
+};
+}
+if (useInsideStyleCache) {
+textStyle.textFill = '#fff';
+// Consider text with #fff overflow its container.
+if (textStyle.textStroke == null) {
+textStyle.textStroke = autoColor;
+textStyle.textStrokeWidth == null && 
(textStyle.textStrokeWidth = 2);
+}
+}
+if (useAutoColorCache) {
+textStyle.textFill = autoColor;
 }
-}
-else if (autoColor != null) {
-insideRollback = {textFill: null};
-textStyle.textFill = autoColor;
 }
 
-// Always set `insideRollback`, for clearing previous.
-if (insideRollback) {
-textStyle.insideRollback = insideRollback;
-}
+// Always set `insideRollback`, so that the previous one can be cleared.
+textStyle.insideRollback = insideRollback;
 }
 
 /**
@@ -1007,6 +1004,7 @@ function applyDefaultTextStyle(textStyle) {
 function rollbackDefaultTextStyle(style) {
 var insideRollback = style.insideRollback;
 if (insideRollback) 

[incubator-echarts] 01/03: tweak.

2018-06-25 Thread sushuang
This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit a7dd06ab6b7be5f808bde41df082a707ed8bce27
Author: sushuang 
AuthorDate: Wed Jun 20 22:17:22 2018 +0800

tweak.
---
 src/chart/custom.js| 5 -
 src/component/brush/brushAction.js | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/chart/custom.js b/src/chart/custom.js
index b665903..ae15147 100644
--- a/src/chart/custom.js
+++ b/src/chart/custom.js
@@ -335,6 +335,9 @@ function makeRenderItem(customSeries, data, ecModel, api) {
 }, prepareResult.api || {});
 
 var userParams = {
+// The life cycle of context: current round of rendering.
+// The global life cycle is probably not necessary, because
+// user can store global status by themselves.
 context: {},
 seriesId: customSeries.id,
 seriesName: customSeries.name,
@@ -582,7 +585,7 @@ function mergeChildren(el, dataIndex, elOption, 
animatableModel, data) {
 var notMerge = mergeChildren === false;
 
 // For better performance on roam update, only enter if necessary.
-if (!newChildren.length && !byName && !notMerge) {
+if (!newLen && !byName && !notMerge) {
 return;
 }
 
diff --git a/src/component/brush/brushAction.js 
b/src/component/brush/brushAction.js
index 1e5f160..b784bd5 100644
--- a/src/component/brush/brushAction.js
+++ b/src/component/brush/brushAction.js
@@ -58,6 +58,6 @@ echarts.registerAction(
  * }
  */
 echarts.registerAction(
-{type: 'brushSelect', event: 'brushSelected', update: 'none'},
+{type: 'brushSelect', event: 'brushSelected', update: 'none'},
 function () {}
 );
\ No newline at end of file


-
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org



[incubator-echarts] 01/03: tweak

2018-04-22 Thread sushuang
This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit bd9403e52a0ae87c929229509225910d6888690f
Author: sushuang 
AuthorDate: Mon Apr 23 04:39:27 2018 +0800

tweak
---
 src/layout/barGrid.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/layout/barGrid.js b/src/layout/barGrid.js
index 2dab497..51eeff4 100644
--- a/src/layout/barGrid.js
+++ b/src/layout/barGrid.js
@@ -223,8 +223,9 @@ export function retrieveColumnLayout(barWidthAndOffset, 
axis, seriesModel) {
 if (barWidthAndOffset && axis) {
 var result = barWidthAndOffset[getAxisKey(axis)];
 if (result != null && seriesModel != null) {
-return result[getSeriesStackId(seriesModel)];
+result = result[getSeriesStackId(seriesModel)];
 }
+return result;
 }
 }
 

-- 
To stop receiving notification emails like this one, please contact
sushu...@apache.org.

-
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org