mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 20:25:06 +00:00
Canvas::queued is a derived prop; ViewRequest is non-exhaustive
This commit is contained in:
@@ -177,7 +177,12 @@ pub struct Canvas<'a> {
|
||||
/// disabled for this canvas.
|
||||
#[prop]
|
||||
layer_bounds: Option<LayerBounds<'a>>,
|
||||
/// The view commands the app asks of this canvas ([`queued`](Self::queued)).
|
||||
/// View commands the app asks of this canvas's view (a menu row or an action step it runs, a new document's fit):
|
||||
/// the canvas runs them in this pass, in order and before the ones fired to it, as it runs those. A
|
||||
/// [`ViewRequest::Command`] eases as a fired command does; a [`ViewRequest::Place`] that moves the view makes the
|
||||
/// pass's view jump. A measuring run runs none. The app asks for them until a pass that is not a measuring run
|
||||
/// showed the canvas, then drops them.
|
||||
#[prop]
|
||||
queued: &'a [ViewRequest],
|
||||
/// The user's navigation options: how the wheel and a pinch move the view ([`WheelNavigation`]), whether a zoom
|
||||
/// eases (Animated Zoom) and whether the view may leave the document (Overscroll).
|
||||
@@ -327,17 +332,6 @@ impl<'a> Canvas<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// View commands the app asks of this canvas's view (a menu row or an action step it runs, a new document's fit):
|
||||
/// the canvas runs them in this pass, in order and before the ones fired to it, as it runs those. A
|
||||
/// [`ViewRequest::Command`] eases as a fired command does; a [`ViewRequest::Place`] that moves the view makes the
|
||||
/// pass's view jump. A measuring run runs none. The app asks for them until a pass that is not a measuring run
|
||||
/// showed the canvas, then drops them.
|
||||
#[must_use]
|
||||
pub fn queued(mut self, commands: &'a [ViewRequest]) -> Self {
|
||||
self.queued = commands;
|
||||
self
|
||||
}
|
||||
|
||||
/// Leaves the view commands to the instance around the canvas that owns its view (a full-window dialog's): the
|
||||
/// canvas is no instance of them, so the chords reach that instance while the canvas has the focus.
|
||||
#[must_use]
|
||||
|
||||
@@ -242,6 +242,7 @@ impl ViewCommands {
|
||||
|
||||
/// A view command an app asks of its canvas ([`Canvas::queued`](super::Canvas::queued)).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ViewRequest {
|
||||
/// A command the user gave (a menu row, an action step): it eases under Animated Zoom, as its chord does.
|
||||
Command(ViewCommands),
|
||||
|
||||
Reference in New Issue
Block a user