Comments (13)
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.
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.
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.
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.
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.
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.
The zoom icons still need to be drawn.
from patternpaint.
Added icons (from icons88), and put the actions in the menu bar:
1b1d4a3
from patternpaint.
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.
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.
Would be the best solution, but would have to rewrite the whole frameeditor?
I know myself too little with the QLabel, QWidget ...
from patternpaint.
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.
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.
Fully implemented as of here:
45fd303
from patternpaint.
Related Issues (20)
- Output preview doesn't update when scene changes HOT 1
- Windows release: Switch to new timestamp server
- Refactor FirmwareStore to emit MemorySections instead of QByteArray HOT 1
- Implement zoom to fit, zoom height, zoom width seperately HOT 2
- Output Preview doesn't clear when last pattern deleted HOT 1
- Pattern edits don't get stored
- Upload dialog doesn't close automatically if there was an upload error HOT 2
- BlinkyTape: Pattern Upload broken HOT 2
- Scrolling Pattern can have a size mismatch with fixture
- Switching to a frame-based image of length 1 doesn't update the frame display correctly HOT 1
- Translation of the user interface HOT 5
- Sparkle updater not translated HOT 2
- Debug log can be opened multiple times
- Drag to re-order patterns broken HOT 1
- Patterns cannot be re-arranged in Qt 5.9 HOT 2
- Writing too fast to Lightbuddy causes it to freeze HOT 2
- 'Cancel' doesn't work when uploading patterns to EightByEight
- BlinkyTape: Default firmware dark on lowest brightness setting HOT 1
- qtcreator: No executable specified HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patternpaint.