feat(chaosymmetry): implemented adjustable multiplier for zooming and panning commands#9
Open
feat(chaosymmetry): implemented adjustable multiplier for zooming and panning commands#9
Conversation
… panning commands
d5d4e47 to
08f2580
Compare
| window: Option<Arc<Window>>, | ||
| pixels: Option<Pixels<'static>>, | ||
| render: Renderer, | ||
| mult: Mult, |
Owner
There was a problem hiding this comment.
Aangezien dit in de App zit zou ik de struct iets generieker noemen, bv:
InputState {
buffer: String,
last_input: Instant
}
Dan kunnen we dat nog voor andere zaken ook gebruiken, terwijl Mult impliceert dat er maar 1 functie is voor inputs.
| && event.state.is_pressed() | ||
| if event.state.is_pressed() | ||
| // Since "+" requires pressing "Shift", this would otherwise reset the multiplier to "1" before zooming in | ||
| && event.logical_key != Key::Named(winit::keyboard::NamedKey::Shift) |
Owner
There was a problem hiding this comment.
Dit kunnen we denk ik nog wel wat refactoren:
- Hier is een example van hoe winit zelf het doet: https://github.com/rust-windowing/winit/blob/master/examples/application.rs#L461-L476
- Deze method kan van pas komen: https://docs.rs/winit/latest/winit/platform/modifier_supplement/trait.KeyEventExtModifierSupplement.html#tymethod.text_with_all_modifiers
En aangezien de is_pressed() nu buiten staat kunnen we hier wel overwegen om een grote match statement te maken. Da gaat properder zijn en geeft veel opties door de flexibiliteit van de syntax in match statements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented commands à la vim, where a numerical factor can be typed in before a command (zooming or panning) to apply it multiple times. Multiple digits can be typed in. The multiplier is valid for 5 seconds, after which it resets. The multiplier also resets after a command is executed, or any other not (yet) supported key is pressed. Saving the image as a .png file also resets the multiplier, although the multiplier has no effect on that action.