Skip to content

Commit

Permalink
Merge pull request #39 from Cactice/reuse-in-other-repo
Browse files Browse the repository at this point in the history
Support nested layout and constraints.json
  • Loading branch information
Cactice authored Dec 30, 2023
2 parents 3c4a311 + 18a9580 commit 6c379c0
Show file tree
Hide file tree
Showing 18 changed files with 486 additions and 125 deletions.
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/layout/MenuBar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions examples/layout/src/constraints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Menu #transform #clickable #layout": {
"x": { "Left": 14 },
"y": { "Center": 0.7432861328125 }
},
"MenuBar #transform #layout": { "x": "Scale", "y": { "Top": 118 } },
"Group": { "x": { "Right": 0 }, "y": { "Center": 0 } },
"Vector": { "x": { "Right": -24.5 }, "y": { "Center": -3.5 } },
"Undo #transform #clickable #layout": {
"x": { "Right": -17.5 },
"y": { "Center": -2.1209716796875 }
},
"Grab #transform #clickable #layout": {
"x": { "Center": 0 },
"y": { "Center": 1.3790283203125 }
},
"Ellipse 4": { "x": { "Center": -15 }, "y": { "Center": -7.5 } },
"Ellipse 5": { "x": { "Center": 0 }, "y": { "Center": -7.5 } },
"Ellipse 6": { "x": { "Center": 15 }, "y": { "Center": -7.5 } },
"Ellipse 7": { "x": { "Center": 15 }, "y": { "Center": 7.5 } },
"Ellipse 8": { "x": { "Center": 0 }, "y": { "Center": 7.5 } },
"Ellipse 9": { "x": { "Center": -15 }, "y": { "Center": 7.5 } },
"Rectangle": { "x": "Scale", "y": "Scale" }
}
4 changes: 4 additions & 0 deletions examples/layout/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use experiment::responsive::layout_machine::ConstraintMap;
use experiment::serde_json;
use experiment::{responsive::layout_machine::LayoutMachine, uses::use_svg};
use guppies::bytemuck::cast_slice;
use guppies::{GpuRedraw, Guppy};
use mobile_entry_point::mobile_entry_point;

pub fn main() {
let mut layout_machine = LayoutMachine::default();
let json = include_str!("constraints.json");
layout_machine.constraint_map = serde_json::from_str::<ConstraintMap>(json).unwrap();

let svg_set = use_svg(
include_str!("../MenuBar.svg").to_string(),
Expand Down
8 changes: 4 additions & 4 deletions examples/list/Left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 141 additions & 0 deletions examples/list/V2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c379c0

Please sign in to comment.