import { _decorator, Canvas, error, log, view } from 'cc'
import DialogBase from '../uicomponent/DialogBase'

const { ccclass, property } = _decorator

@ccclass('AdapterHelper')
export default class AdapterHelper {
  public static winSizeWidth: number
  public static winSizeHeiht: number

  public static fixApdater() {
    log('v3.6没找到接口修改 fitHeight、fitWidth, 先在项目里写死fitHeight=true')
    // return
    // const framesize = view.getFrameSize()
    // if (!this.winSizeWidth) {
    //   this.winSizeWidth = screen.width
    //   this.winSizeHeiht = screen.height
    // }
    // const designsize = view.getDesignResolutionSize()
    // const canvas: Canvas = DialogBase.GetRootCanvas().getComponent(Canvas)
    
    // const ratio: number = framesize.height / framesize.width
    // const designRatio: number = designsize.height / designsize.width
    // if (ratio > designRatio) {
    //   canvas.fitHeight = false;
    //   canvas.fitWidth = true;
    //   error('v3.6没找到接口修改 fitHeight、fitWidth, 先在项目里写死fitHeight=true')
    // } else {
    //   // canvas.fitHeight = true;
    //   // canvas.fitWidth = false;
    //   error('v3.6没找到接口修改 fitHeight、fitWidth, 先在项目里写死fitHeight=true')
    // }
  }
}
