Git Product home page Git Product logo

Comments (5)

oparoz avatar oparoz commented on August 25, 2024

I played with the library a bit.

By replacing

imgWidth = (imageWidth > imageHeight && contHeight >= contWidth) || ratio * contHeight > contWidth ? contWidth : ratio * contHeight;

with

// Don't stretch images to fill the container
imgWidth = imageWidth;

I get the wanted effect, which is the image showing up at it's native size or zoomed in if a parameter was passed.

Next is the snap view:

  • The image needs to be resized to match its position in the container (calculate cont/img ratio and crop to snap view)
  • When zooming, the image needs to grow to fill the container, like it is in the main view
  • Once the image in the main view is larger than the container, then the snap handle should show

from iv-viewer.

s-yadav avatar s-yadav commented on August 25, 2024

That part of code is required to contain image inside container, changing that may affect on other modes.

I am out town for few days . Will be fixing once i am back.

from iv-viewer.

oparoz avatar oparoz commented on August 25, 2024

Yeah, I've noticed that the fullscreen mode has the same problem where images will be stretched to fit.
Just ping me when you're back and have time to work on this :).

from iv-viewer.

oparoz avatar oparoz commented on August 25, 2024

Any news? :)

from iv-viewer.

s-yadav avatar s-yadav commented on August 25, 2024

So In ImageViewer now it behaves as backgound-size contain for a given container. And whatever size is coming at that point I am considering it as 100% zoom, which literally is not correct.
There are multiple problems which needs to be figured if image actual dimension to be considered as 100% zoom with current code.

  1. Right now only it can be zoomed when mouse is above image and not the container. But if we take the actual size of image it should happen on container as well.
  2. Zoom level can go below 100 when image actual dimension are greater that container, so minimum cap of 100 need to be removed which requires changes in lot of place.
  3. Need to figure out how to display snapview if zoom level is below 100% .

from iv-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.