100pah commented on a change in pull request #9783: feat(dataZoom): enhance 
dispatchAction for dataZoom. Normalize illega…
URL: https://github.com/apache/incubator-echarts/pull/9783#discussion_r248743185
 
 

 ##########
 File path: src/component/dataZoom/AxisProxy.js
 ##########
 @@ -245,9 +241,31 @@ AxisProxy.prototype = {
             percentWindow[idx] = boundPercent;
         });
 
+        asc(valueWindow);
+        asc(percentWindow);
+
+        // The windows from user calling of `dispatchAction` might be out of 
the extent,
+        // or do not obey the `min/maxSpan`, `min/maxValueSpan`. But we dont 
restrict window
+        // by `zoomLock` here, because we see `zoomLock` just as a interaction 
constraint,
+        // where API is able to initialize/modify the window size even though 
`zoomLock`
+        // specified.
+        var spans = this._minMaxSpan;
+        hasPropModeValue
+            ? restrictSet(valueWindow, percentWindow, dataExtent, 
percentExtent, false)
+            : restrictSet(percentWindow, valueWindow, percentExtent, 
dataExtent, true);
+
+        function restrictSet(fromWindow, toWindow, fromExtent, toExtent, 
toValue) {
+            var suffix = toValue ? 'Span' : 'ValueSpan';
+            sliderMove(0, fromWindow, fromExtent, 'all', spans['min' + 
suffix], spans['max' + suffix]);
+            for (var i = 0; i < 2; i++) {
+                toWindow[i] = numberUtil.linearMap(fromWindow[i], fromExtent, 
toExtent, true);
+                toValue && (toWindow[i] = scale.parse(toWindow[i]));
 
 Review comment:
   `toValue` is a boolean

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to