fix: add setup for scale

This commit is contained in:
lilong.129
2025-02-19 21:52:36 +08:00
parent ce7417c239
commit 422fb58a26
3 changed files with 10 additions and 1 deletions

View File

@@ -350,6 +350,13 @@ func (wd *WDADriver) ScreenShot(opts ...option.ActionOption) (raw *bytes.Buffer,
}
func (wd *WDADriver) toScale(x float64) float64 {
if wd.scale == 0 {
// not setup yet
if err := wd.Setup(); err != nil {
log.Error().Err(err).Msg("init scale failed")
os.Exit(code.GetErrorCode(err))
}
}
return x / wd.scale
}