src/component/dataZoom/roams.js
function mergeControllerParams(dataZoomInfos) {
    var controlType;
    // DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated
    // as string, it is probably revert to reserved word by compress tool. See #7411.
    var prefix = 'type_';
    var typePriority = {
        'type_true': 2,
        'type_move': 1,
        'type_false': 0,
        'type_undefined': -1
    };
    var preventDefaultMouseMove = true;

    zrUtil.each(dataZoomInfos, function (dataZoomInfo) {
        var dataZoomModel = dataZoomInfo.dataZoomModel;
        var oneType = dataZoomModel.get('disabled', true)
            ? false
            : dataZoomModel.get('zoomLock', true)
            ? 'move'
            : true;
        if (typePriority[prefix + oneType] > typePriority[prefix + controlType]) {
            controlType = oneType;
        }

        // Prevent default move event by default. If one false, do not prevent. Otherwise
        // users may be confused why it does not work when multiple insideZooms exist.
        preventDefaultMouseMove &= dataZoomModel.get('preventDefaultMouseMove', true);
    });

    return {
        controlType: controlType,
        opt: {
            // RoamController will enable all of these functionalities,
            // and the final behavior is determined by its event listener
            // provided by each inside zoom.
            zoomOnMouseWheel: true,
            moveOnMouseMove: true,
            moveOnMouseWheel: true,
            preventDefaultMouseMove: !!preventDefaultMouseMove
        }
    };
}
function mergeControllerParams(dataZoomInfos) {
    var controlType;
    // DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated
    // as string, it is probably revert to reserved word by compress tool. See #7411.
    var prefix = 'type_';
    var typePriority = {
        'type_true': 2,
        'type_move': 1,
        'type_false': 0,
        'type_undefined': -1
    };
    var preventDefaultMouseMove = true;

    zrUtil.each(dataZoomInfos, function (dataZoomInfo) {
        var dataZoomModel = dataZoomInfo.dataZoomModel;
        var oneType = dataZoomModel.get('disabled', true)
            ? false
            : dataZoomModel.get('zoomLock', true)
            ? 'move'
            : true;
        if (typePriority[prefix + oneType] > typePriority[prefix + controlType]) {
            controlType = oneType;
        }

        // Prevent default move event by default. If one false, do not prevent. Otherwise
        // users may be confused why it does not work when multiple insideZooms exist.
        preventDefaultMouseMove &= dataZoomModel.get('preventDefaultMouseMove', true);
    });

    return {
        controlType: controlType,
        opt: {
            // RoamController will enable all of these functionalities,
            // and the final behavior is determined by its event listener
            // provided by each inside zoom.
            zoomOnMouseWheel: true,
            moveOnMouseMove: true,
            moveOnMouseWheel: true,
            preventDefaultMouseMove: !!preventDefaultMouseMove
        }
    };
}
function mergeControllerParams ( dataZoomInfos ) { var controlType ; // DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated // as string, it is probably revert to reserved word by compress tool. See #7411. var prefix = 'type_' ; var typePriority = { 'type_true' : 2 , 'type_move' : 1 , 'type_false' : 0 , 'type_undefined' : - 1 } ; var preventDefaultMouseMove = true ; zrUtil . each ( dataZoomInfos , function ( dataZoomInfo ) { var dataZoomModel = dataZoomInfo . dataZoomModel ; var oneType = dataZoomModel . get ( 'disabled' , true ) ? false : dataZoomModel . get ( 'zoomLock' , true ) ? 'move' : true ; if ( typePriority [ prefix + oneType ] > typePriority [ prefix + controlType ] ) { controlType = oneType ; } // Prevent default move event by default. If one false, do not prevent. Otherwise // users may be confused why it does not work when multiple insideZooms exist. preventDefaultMouseMove &= dataZoomModel . get ( 'preventDefaultMouseMove' , true ) ; } ) ; return { controlType : controlType , opt : { // RoamController will enable all of these functionalities, // and the final behavior is determined by its event listener // provided by each inside zoom. zoomOnMouseWheel : true , moveOnMouseMove : true , moveOnMouseWheel : true , preventDefaultMouseMove : ! ! preventDefaultMouseMove } } ; }
Merge roamController settings when multiple dataZooms share one roamController.
Merge roamController settings when multiple dataZooms share one roamController .