ScaleChangedModel constructor
ScaleChangedModel({})
Implementation
ScaleChangedModel({this.scale=1.0, this.offset=Offset.zero, this.size=Size.zero, this.focalOffset=Offset.zero, this. preFocalOffset=Offset.zero, double currentScale=1.0}) {
Offset offset = this.offset;
double dx = offset.dx;
double dy = offset.dy;
Size size = this.size;
if (size != null) {
double width = size.width;
int move = (width + dx.abs()).toInt();
int imagWidth = (width * scale).toInt();
print("dx $dx move $move imagWidth$imagWidth");
///放大的图像是否滑动到了右边界
if (move == imagWidth) {
this.isRightBorder = true;
} else {
this.isRightBorder = false;
}
///放大的图像是否滑动到了左边界
if (dx == 0) {
this. isLeftBorder = true;
} else {
this.isLeftBorder = false;
}
}
if(preFocalOffset!=null&&focalOffset!=null &¤tScale==1.0){
double preDx = preFocalOffset.dx;
double preDy = preFocalOffset.dy;
double focalDx = focalOffset.dx;
double focalDy = focalOffset.dy;
double flagDx = focalDx - preDx;
double flagDy = focalDy - preDy;
if(flagDx<0){
currentHorizontalSlideDirectionType = SlideDirectionType.tooRight;
}else{
currentHorizontalSlideDirectionType = SlideDirectionType.toLeft;
}
if(flagDy<0){
currentVerticalSlideDirectionType = SlideDirectionType.toBottom;
}else{
currentVerticalSlideDirectionType = SlideDirectionType.toTop;
}
// print("currentVerticalSlideDirectionType $currentVerticalSlideDirectionType currentHorizontalSlideDirectionType $currentHorizontalSlideDirectionType");
}else{
currentVerticalSlideDirectionType = SlideDirectionType.none;
currentHorizontalSlideDirectionType = SlideDirectionType.none;
}
}