Giter Site home page Giter Site logo

Comments (13)

cibomahto avatar cibomahto commented on August 26, 2024

This would be useful! Here's an example of how to scale the window:
a0897b8

The frame editor already contains code to do fractional scaling (since it can adjust to the window size), so the challenges here I think are more about how the interface should work. Some references below

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

photoshop zoom
Photoshop has image scaling functions in the 'View' menu:
-Zoom in (ctrl++): zoom in by some amount (..., 12.5%, 16.7%, 25%, 33.3%. 50%, 66.7%, 100%, 200%, 300%, 400%, 500%, 600%, 700%, 800%, 1200%, 1600%, ...)
-Zoom out (ctrl+-): zoom out by some amount (same steps as zoom in)
-Fit on screen (ctrl+0): maximize image inside screen (both horizontally and vertically)
-Fit artboard on screen (not relevant, unless we think of the fixture layout as the artboard- ignore this for now)
-100% (ctrl+1): sets scale to 1:1 (no zoom)
-200%: sets scale to 2:1
-Print Size: (not relevant)

For the mouse (on windows):
-alt+scroll, zooms in/out freely (not by steps),
-ctrl+scroll vertical pans left/right
-shift+scroll vertical pans up/down

Touchpad (on windows):
-alt+pinch, and alt+scroll zoom in/out freely
-shift+swipe pans in both directions
-ctrl+swipe pans in both directions

The touchpad on macOS might work differently, I need to install it on a machine to test.

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

ms paint zoom
MS paint has a ribbon with:
-Zoom in: Zoom in by some amount (12.5, 25, 50, 100, 200, 300, 400, 500, 600, 700, 800)
-Zoom out: Zoom out by some amount (same steps)
-100%: sets scale to 1:1

It also has a slider at the bottom right that selects the same scale

For the mouse:
ctrl+scroll: zoom in and out by the same steps as above
scroll: pan up/down

Touchpad:
pinch: zooms in/out by the same steps as above
swipe: pans in all directions

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

screen shot 2017-02-11 at 1 29 05 pm
On macOS, Preview has image scaling functions similar to Photoshop, in the 'View' menu:
-Actual size (cmd+0): zoom 1:1
-Zoom to fit (cmd+9): zooms to show whole image in windows
-Zoom in (cmd++): zooms in by some amount
-Zoom out (cmd+-): zooms out by some amount
-Zoom to selection (cmd+*): zooms to fit the current selection in the window

In addition, the 'actual size' and 'zoom to fit' selections are persistent, so:
-if you manually select 'zoom to fit', then later resize the window, the image will be scaled to fit the max size of the window
-'Zoom to fit' is cleared if any of the manual zoom options are used to resize the image
-However, if you then resize the window manually and it comes close to the image size, the 'zoom to fit' option will be re-enabled, and the image size will snap to the window size.
-manually selecting 'actual size' disables the above snap feature, however if you then resize the window manually, the 'actual size' feature is disabled, and the above snap feature will work again.

Mouse:
scroll wheel: pans up/down
shift+scroll wheel: pans left/right

Touchpad:
pinch: zooms in/out freely
swipe: pans in all directions

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

Personally I prefer the behavior of Preview the most; it feels like it mostly just does useful things. The default behavior in PatternPaint right now is similar to the 'zoom to fit' option in Preview, but not in Photoshop since it isn't persistent.

Any other programs that might be good to look at for reference?

from patternpaint.

nightflyer88 avatar nightflyer88 commented on August 26, 2024

Looks good, I made a try:
https://github.com/nightflyer88/PatternPaint/tree/test-zoom

There are still problems with the zoom to fit, because it only works if the frameeditor is smaller than the window.

bildschirmfoto 2017-02-11 um 12 25 40

The zoom icons still need to be drawn.

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

Added icons (from icons88), and put the actions in the menu bar:
1b1d4a3

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

I think the 'zoom to fit' option should be enabled by default (and work continuously), so the behavior is more consistent with the original behavior for PatternPaint.

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

It's probably better to redesign this to use the scrollarea to do the zooming:
https://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-example.html

from patternpaint.

nightflyer88 avatar nightflyer88 commented on August 26, 2024

Would be the best solution, but would have to rewrite the whole frameeditor?

I know myself too little with the QLabel, QWidget ...

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

I think it would just be some re-arranging of the message handlers for zoom, and then implementing the mouse and gesture events in the scroll area instead of in the frame editor. The main reason is that when zooming using a mouse or gesture, it's way more natural if the zoom happens around the focus of the cursor (or center of the gesture), which means it's actually a zoom+pan operation. My guess is that it's easier to do that from the scroll area, since it keeps the state for the active scroll region.

But that's an enhancement to the zoom feature, so we can maybe make that a separate issue and go with this implementation for now.

from patternpaint.

nightflyer88 avatar nightflyer88 commented on August 26, 2024

So have made a few attempts. The problem with the scrollArea is that the image is not rendered at the zoom. The same with QPainter painter.scale()

Look at this, I think that is still the better solution:
https://github.com/nightflyer88/PatternPaint/tree/scaling

from patternpaint.

cibomahto avatar cibomahto commented on August 26, 2024

Fully implemented as of here:
45fd303

from patternpaint.

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.