ImageScrollView icon indicating copy to clipboard operation
ImageScrollView copied to clipboard

Random auto zoom-out issues

Open sabiland opened this issue 4 years ago • 5 comments

I was testing ImageScrollView yesterday (latest Xcode and iPhone 11 with iOS 15) and there are some random issues with it. When zooming, panning, randomly auto zoom-out happens. It looks like some timer is firing and zooming-out to default zoom ?

sabiland avatar Nov 12 '21 06:11 sabiland

Could this be the issue? #55

davuthdv avatar Dec 15 '21 16:12 davuthdv

No, this cannot be the issue. I am using only portrait mode on iPhone and this happens. Or can this happen also if I have locked orientation?

sabiland avatar Jan 22 '22 08:01 sabiland

Sorry, but I couldn't test for you right now. I did have my orientation locked and I did face that issue. I can't remember clearly. But I'm pretty sure that following the suggestion to comment out that line fixed the issue that I had.

davuthdv avatar Jan 25 '22 10:01 davuthdv

Ok thx for info, I'll try it and comment it later. So commenting that line will stop updating view (as intended by library) on iPad rotations.

EDIT: Shit, I've just found out you cannot edit Swift Package code :)

sabiland avatar Jan 26 '22 07:01 sabiland

Ok, I took source code version and fixed the issue.

@objc func changeOrientationNotification() {
        
        // SABI TWEAK
        if Helper.checkIPhone()
        {
            // Ignore ON IPHONE !!!
            return
        }
        else
        {
            // Take only valid orientations on iPad
            if UIDevice.current.orientation.isValidInterfaceOrientation
            {
                // On iPad ONLY if valid orientation !!!   
                // A weird bug that frames are not update right after orientation changed. Need delay a little bit with async.
                DispatchQueue.main.async {
                    self.configureImageForSize(self.imageSize)
                    self.imageScrollViewDelegate?.imageScrollViewDidChangeOrientation(imageScrollView: self)
                }
            }
        }
    }

sabiland avatar Jun 24 '22 07:06 sabiland