
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/* global Float32Array */
import createRenderPlanner from '../helper/createRenderPlanner.js';
import { error } from '../../util/log.js';
import { each } from 'tvrender/lib/core/util.js';
function getHLinePoints(seriesModel, value) {
  var coordSys = seriesModel.coordinateSystem;
  var xAxis = coordSys.getAxis('x');
  var y = coordSys.dataToPoint([0, value])[1];
  var _a = xAxis.getExtent(),
    startX = _a[0],
    endX = _a[1];
  return [[xAxis.toGlobalCoord(startX), y], [xAxis.toGlobalCoord(endX), y]];
}
var hLinesLayout = {
  seriesType: 'hlines',
  plan: createRenderPlanner(),
  reset: function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    if (!coordSys) {
      if (process.env.NODE_ENV !== 'production') {
        error('The lines series must have a coordinate system.');
      }
      return;
    }
    // const z2 = seriesModel.get('z2')
    return {
      progress: function (params, lineData) {
        var data = seriesModel.get('data');
        each(data, function (item, index) {
          if (item.invisible) {
            return;
          }
          var points = getHLinePoints(seriesModel, item.value);
          lineData.setItemLayout(index, points);
          var itemData = lineData.getItemModel(index);
          var lineStyle = itemData.getModel('lineStyle').getLineStyle();
          var z2 = itemData.get('z2');
          lineData.setItemVisual(index, {
            z2: z2,
            style: lineStyle
          });
        });
      }
    };
  }
};
export default hLinesLayout;