import { useState, useEffect, useMemo } from 'react';

export function getLines(width, text) {
  var length = text.length;
  var base = 28;
  for (var i = 0; i < length; i++) {
    //大于28 2个 大于40
    if (width >= base + 12 * i) {
    }
  }
}
export function getMaxScale(data) {
  var maxScaleTemp = 1.1;
  if (data.length > 0) {
    //找到合适的最大缩放倍数
    for (var i = 1; i < 12; i++) {
      var num = 0;
      data.forEach((item, index) => {
        var mwidth = item.width * maxScaleTemp;
        if (mwidth > 75) {
          num = num + 1;
        }
      });
      console.log('width', num, data.length, i);

      if (num / data.length > 0.9) {
        break;
      } else {
        maxScaleTemp = maxScaleTemp + 0.1;
      }
    }
  }
  return maxScaleTemp;
}
