43 lines
685 B
Dart
43 lines
685 B
Dart
class FitTool {
|
|
static double rpx = 0;
|
|
static bool isInit = false;
|
|
static init(double v) {
|
|
if (v < 1) {
|
|
return;
|
|
}
|
|
if (isInit == false) {
|
|
isInit = true;
|
|
// rpx = v / 750.0;
|
|
rpx=v/1624.0;
|
|
}
|
|
}
|
|
|
|
static double getPx(double size) {
|
|
return rpx * size * 2.0;
|
|
}
|
|
|
|
static double getRpx(double size) {
|
|
return rpx * size;
|
|
}
|
|
}
|
|
|
|
extension FitInt on int {
|
|
double get px {
|
|
return FitTool.getPx(this.toDouble());
|
|
}
|
|
|
|
double get rpx {
|
|
return FitTool.getRpx(this.toDouble());
|
|
}
|
|
}
|
|
|
|
extension FitDouble on double {
|
|
double get px {
|
|
return FitTool.getPx(this);
|
|
}
|
|
|
|
double get rpx {
|
|
return FitTool.getRpx(this);
|
|
}
|
|
}
|