Giter Club home page Giter Club logo

Comments (6)

mwcraig avatar mwcraig commented on August 23, 2024

I think these are two different operations, though arguably the names could be better.

zoom_level: a specific zoom relative to the scale (1 screen pixel) = (1 image pixel)

zoom: a factor by which to change the current zoom_level, e.g. "I want to zoom in another factor 1.5" . A better name might be zoom_by.

from astrowidgets.

pllim avatar pllim commented on August 23, 2024

But do we need both? 🤔

from astrowidgets.

mwcraig avatar mwcraig commented on August 23, 2024

I think we do in the context of user interactions. Imagine you have been doing some zoom in/zoom out by mouse or scroll wheel or whatever. You probably have no idea what your current zoom_level is but might know that you want to zoom by additional factor in or out.

One could calculate the new zoom_level manually but that seems cumbersome.

The other difference I see between them is that zoom_level is part of the state of the view/a property and zoom is an action/method.

from astrowidgets.

pllim avatar pllim commented on August 23, 2024

So, should we remove the zoom_level setter and make it read-only?

from astrowidgets.

mwcraig avatar mwcraig commented on August 23, 2024

I'm inclined not to because I see setting a specific level and zooming by a particular factor as different things. In a widget implementation, allowing zoom_level to be settable in the API means it is fine to make it a traitlet, which makes it easy to link the zoom level of two browsers.

from astrowidgets.

pllim avatar pllim commented on August 23, 2024

Ah, gotcha...

from astrowidgets.

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.