Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI 0.11
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI 0.11
Commits
71d98f5c
Unverified
Commit
71d98f5c
authored
2 years ago
by
Jacob LeCoq
Browse files
Options
Downloads
Patches
Plain Diff
use window params for first frame camera computations
parent
7e9d4562
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/widgets/app.rs
+24
-0
24 additions, 0 deletions
src/widgets/app.rs
with
24 additions
and
0 deletions
src/widgets/app.rs
+
24
−
0
View file @
71d98f5c
...
@@ -43,8 +43,10 @@ pub fn app_update(
...
@@ -43,8 +43,10 @@ pub fn app_update(
In
((
widget_context
,
entity
,
previous_props_entity
)):
In
<
(
KayakWidgetContext
,
Entity
,
Entity
)
>
,
In
((
widget_context
,
entity
,
previous_props_entity
)):
In
<
(
KayakWidgetContext
,
Entity
,
Entity
)
>
,
widget_param
:
WidgetParam
<
KayakApp
,
EmptyState
>
,
widget_param
:
WidgetParam
<
KayakApp
,
EmptyState
>
,
camera
:
Query
<&
Camera
,
With
<
CameraUIKayak
>>
,
camera
:
Query
<&
Camera
,
With
<
CameraUIKayak
>>
,
windows
:
Res
<
Windows
>
,
)
->
bool
{
)
->
bool
{
let
mut
window_change
=
false
;
let
mut
window_change
=
false
;
if
let
Ok
(
app_style
)
=
widget_param
.style_query
.get
(
entity
)
{
if
let
Ok
(
app_style
)
=
widget_param
.style_query
.get
(
entity
)
{
if
let
Some
(
camera_entity
)
=
widget_context
.camera_entity
{
if
let
Some
(
camera_entity
)
=
widget_context
.camera_entity
{
if
let
Ok
(
camera
)
=
camera
.get
(
camera_entity
)
{
if
let
Ok
(
camera
)
=
camera
.get
(
camera_entity
)
{
...
@@ -55,6 +57,15 @@ pub fn app_update(
...
@@ -55,6 +57,15 @@ pub fn app_update(
if
app_style
.height
!=
StyleProp
::
Value
(
Units
::
Pixels
(
size
.y
))
{
if
app_style
.height
!=
StyleProp
::
Value
(
Units
::
Pixels
(
size
.y
))
{
window_change
=
true
;
window_change
=
true
;
}
}
}
else
{
let
primary_window
=
windows
.get_primary
()
.unwrap
();
if
app_style
.width
!=
StyleProp
::
Value
(
Units
::
Pixels
(
primary_window
.width
()))
{
window_change
=
true
;
}
if
app_style
.height
!=
StyleProp
::
Value
(
Units
::
Pixels
(
primary_window
.height
()))
{
window_change
=
true
;
}
}
}
}
}
}
}
...
@@ -69,6 +80,8 @@ pub fn app_render(
...
@@ -69,6 +80,8 @@ pub fn app_render(
mut
commands
:
Commands
,
mut
commands
:
Commands
,
mut
query
:
Query
<
(
&
mut
KStyle
,
&
KChildren
)
>
,
mut
query
:
Query
<
(
&
mut
KStyle
,
&
KChildren
)
>
,
camera
:
Query
<&
Camera
,
With
<
CameraUIKayak
>>
,
camera
:
Query
<&
Camera
,
With
<
CameraUIKayak
>>
,
windows
:
Res
<
Windows
>
,
images
:
Res
<
Assets
<
Image
>>
,
)
->
bool
{
)
->
bool
{
let
(
mut
width
,
mut
height
)
=
(
0.0
,
0.0
);
let
(
mut
width
,
mut
height
)
=
(
0.0
,
0.0
);
...
@@ -77,6 +90,17 @@ pub fn app_render(
...
@@ -77,6 +90,17 @@ pub fn app_render(
if
let
Some
(
size
)
=
camera
.logical_viewport_size
()
{
if
let
Some
(
size
)
=
camera
.logical_viewport_size
()
{
width
=
size
.x
;
width
=
size
.x
;
height
=
size
.y
;
height
=
size
.y
;
}
else
if
let
Some
(
viewport
)
=
camera
.target
.get_render_target_info
(
&
windows
,
&
images
)
.as_ref
()
.map
(|
target_info
|
{
let
scale
=
target_info
.scale_factor
;
(
target_info
.physical_size
.as_dvec2
()
/
scale
)
.as_vec2
()
})
{
width
=
viewport
.x
;
height
=
viewport
.y
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment