RavenRS · Rust GUI
ZoomPanView
Edit and run the ZoomPanView RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.
One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.
Rust source
fn zoom_pan_view() -> impl View {
let view = State::new(ZoomView::fit());
let content = Size::new(1200.0, 800.0);
let picture = |frame: ZoomPanPaint, scene: &mut Scene| {
// ravenrs-lint: allow(raw_color) the stand-in photograph being zoomed: its colors are the content
scene.push_quad(Quad::new(frame.placed, Color::rgb(0.16, 0.3, 0.5)));
let side = 120.0 * frame.scale;
// ravenrs-lint: allow(raw_color) the stand-in photograph being zoomed: its colors are the content
for (i, color) in [Color::rgb(0.9, 0.45, 0.3), Color::rgb(0.95, 0.8, 0.3)].into_iter().enumerate() {
let x = frame.placed.x() + frame.placed.width() * (0.2 + 0.4 * i as f32);
let y = frame.placed.y() + frame.placed.height() * 0.35;
scene.push_quad(Quad::new(Rect::new(x, y, side, side), color).radius(side / 2.0));
}
};
VStack::new((
ZoomControl::new(view.binding()),
ZoomPanView::custom(view.binding(), content, picture).size(420.0, 200.0).label("Sample picture"),
))
.spacing(8.0)
}The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.
More examples
AccordionAlertAnchorAppShellAreaChartAspectRatioAttachmentStripAudioPlayerButtonAvatarBadgeBarChartBarcodeBreadcrumbButtonButtonGroupCalendarCanvasCardCardViewCarouselChartChartCardChartReferenceChatCheckboxCodeBlockCodeEditorCollapseColorPairColorPickerColorSwatchColorWheelComboboxCommandPaletteCompareViewConfirmDialogContextMenuCountUpCropOverlayCurveEditorDataGridDatePickerDateRangePickerDateTimePickerDaySeparatorDialogDisclosureDividerDockAreaDocumentTabsDotDropdownMenuDropZoneEmptyStateEventCalendarExpressionEditorEyedropperFavoriteToggleFileBrowserFileUploadFilmstripFilterBuilderFloatingPanelFloatingToolbarFooterFormFieldFormLayoutGlassCardGridHelpTipHeroBannerHistogramHoverCardHStackIconIconButtonIconTileImageImageFieldImageLightboxInlineRenameInputOtpKbdLabelLinkListLookupFieldLottieMarqueeMaskedFieldMenubarMinimapModelPickerMovieAssistantMoviePlayerMultiProgressNinePointAnchorNumberFieldOverlayBadgePagedDocumentViewPageHeaderPaginationPlaygroundPopoverProgressBarPropertyRowProtractorQuadFieldRadioGroupRatingRecurrenceEditorReleaseNotesRibbonRichTextRubberBandRuleOfThirdsGridRulerSankeyChartSchedulerScrollEdgeArrowScrollLinkedScrollSceneScrollViewSectionSegmentedControlSelectSelectionBarSheetShimmerTextShortcutHintBarShortcutSheetSidebarSidebarBrandSkeletonSliderSortableListSpacerSpinnerSplashScreenSplitButtonSplitHandleSplitPanesSplitterStatStatusBarStepBadgeStepIndicatorStepperStickySwatchGridTableTabsTagBoxTextTextAreaTextFieldThemeEditorThemePickerThemeSwitcherTickerTileLayoutTimelineTimePickerTitleBarToasterToggleToggleButtonToggleGroupToolbarToolRailTooltipTransformHandlesTreeViewValueSliderVirtualListVStackWizardYearViewZoomControlZoomPanViewZStack