File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
apps/scene-ui-examples/src
packages/hmans-scene-ui/src/components Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
import "r3f-stage/styles.css"
2
2
import { Application } from "r3f-stage"
3
3
import * as UI from "@hmans/scene-ui"
4
+ import { RectProps } from "@hmans/scene-ui"
4
5
5
6
export const App = ( ) => {
6
7
return (
7
8
< Application >
8
9
< UI . Canvas width = { 8 } height = { 4 } debug >
9
- < UI . Rect left = { "50%" } top = { "100%" } bottom = { 0 } right = { "50%" } >
10
- < UI . Rect top = { - 1.25 } bottom = { 0.25 } left = { 2 } right = { 2 } />
11
- </ UI . Rect >
10
+ < BottomCenter >
11
+ < UI . Rect bottom = { 1.5 } width = { 4 } height = { 1 } />
12
+ </ BottomCenter >
12
13
</ UI . Canvas >
13
14
</ Application >
14
15
)
15
16
}
17
+
18
+ const BottomCenter = ( props : RectProps ) => (
19
+ < UI . Rect left = { "50%" } top = { "100%" } bottom = { 0 } right = { "50%" } { ...props } />
20
+ )
Original file line number Diff line number Diff line change @@ -72,8 +72,8 @@ export const Rect = ({
72
72
const bottom = resolveRatio ( _bottom , parent . height )
73
73
const left = resolveRatio ( _left , parent . width )
74
74
75
- const width = parent . width - left - right
76
- const height = parent . height - top - bottom
75
+ const width = _width ? _width : parent . width - left - right
76
+ const height = _height ? _height : parent . height - top - bottom
77
77
78
78
return (
79
79
< group { ...props } >
You can’t perform that action at this time.
0 commit comments