mirror of
https://github.com/danbulant/mangui
synced 2026-07-08 12:20:34 +00:00
image demo
This commit is contained in:
parent
866a526605
commit
8a63a219c5
2 changed files with 23 additions and 1 deletions
BIN
mangades/demo/large/bx117324-97mHyfJGwpBq.jpg
Normal file
BIN
mangades/demo/large/bx117324-97mHyfJGwpBq.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
|
|
@ -1,6 +1,6 @@
|
||||||
use rusalka_macro::make_component;
|
use rusalka_macro::make_component;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use mangui::{SharedNode, nodes::Style, taffy::prelude::Size, femtovg::{Paint, Color}, nodes::layout::Layout};
|
use mangui::{femtovg::ImageFlags, nodes::{layout::Layout, Style}, nodes::image::Image, taffy::prelude::Size};
|
||||||
|
|
||||||
use rusalka::nodes::primitives::{Rectangle, RectangleAttributes, PartialRectangleAttributes};
|
use rusalka::nodes::primitives::{Rectangle, RectangleAttributes, PartialRectangleAttributes};
|
||||||
|
|
||||||
|
|
@ -8,6 +8,10 @@ make_component!(
|
||||||
ComponentDemo,
|
ComponentDemo,
|
||||||
MainLogic {
|
MainLogic {
|
||||||
let _radius = attrs.radius;
|
let _radius = attrs.radius;
|
||||||
|
let imgpath = std::path::PathBuf::from("./demo/large/bx117324-97mHyfJGwpBq.jpg");
|
||||||
|
let imgflags = ImageFlags::empty();
|
||||||
|
let width = 230.;
|
||||||
|
let height = 325.;
|
||||||
}
|
}
|
||||||
Attributes {
|
Attributes {
|
||||||
radius: f32
|
radius: f32
|
||||||
|
|
@ -24,6 +28,24 @@ make_component!(
|
||||||
radius: if $test_ { attrs.radius } else { 0. },
|
radius: if $test_ { attrs.radius } else { 0. },
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@image {
|
||||||
|
style: Style {
|
||||||
|
layout: mangui::nodes::TaffyStyle {
|
||||||
|
min_size: Size {
|
||||||
|
width: mangui::taffy::style::Dimension::Points(width),
|
||||||
|
height: mangui::taffy::style::Dimension::Points(height)
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
image: mangui::nodes::image::ImageLoad::LoadFile(imgpath, imgflags),
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
radius: 5.,
|
||||||
|
events: Default::default(),
|
||||||
|
parent: None
|
||||||
|
}
|
||||||
$|event| {
|
$|event| {
|
||||||
match event.event {
|
match event.event {
|
||||||
mangui::events::InnerEvent::MouseDown(_) => {
|
mangui::events::InnerEvent::MouseDown(_) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue