Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
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
Bevy Cosmic Edit
Commits
79de1d66
Commit
79de1d66
authored
1 year ago
by
sam edelsten
Browse files
Options
Downloads
Patches
Plain Diff
add minimum padding, fixing centered infiniteline
parent
64310920
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/layout.rs
+1
-0
1 addition, 0 deletions
src/layout.rs
src/render.rs
+4
-10
4 additions, 10 deletions
src/render.rs
with
5 additions
and
10 deletions
src/layout.rs
+
1
−
0
View file @
79de1d66
...
...
@@ -148,6 +148,7 @@ pub fn set_x_offset(
}
let
padding_x
=
match
position
{
// TODO: This 5 should be specified by user
CosmicTextPosition
::
Center
=>
5.
,
CosmicTextPosition
::
TopLeft
{
padding
}
=>
*
padding
as
f32
,
CosmicTextPosition
::
Left
{
padding
}
=>
*
padding
as
f32
,
...
...
This diff is collapsed.
Click to expand it.
src/render.rs
+
4
−
10
View file @
79de1d66
...
...
@@ -4,8 +4,8 @@ use image::{imageops::FilterType, GenericImageView};
use
crate
::{
layout
::{
CosmicPadding
,
CosmicWidgetSize
},
CosmicBackground
,
CosmicBuffer
,
CosmicEditor
,
CosmicFontSystem
,
C
osmicTextPosition
,
CursorColor
,
DefaultAttrs
,
FillColor
,
ReadOnly
,
SelectionColor
,
XOffset
,
CosmicBackground
,
CosmicBuffer
,
CosmicEditor
,
CosmicFontSystem
,
C
ursorColor
,
DefaultAttrs
,
FillColor
,
ReadOnly
,
SelectionColor
,
XOffset
,
};
#[derive(Resource)]
...
...
@@ -77,7 +77,6 @@ pub(crate) fn render_texture(
&
CosmicPadding
,
&
XOffset
,
Option
<&
ReadOnly
>
,
&
CosmicTextPosition
,
)
>
,
mut
font_system
:
ResMut
<
CosmicFontSystem
>
,
mut
images
:
ResMut
<
Assets
<
Image
>>
,
...
...
@@ -96,7 +95,6 @@ pub(crate) fn render_texture(
padding
,
x_offset
,
readonly_opt
,
position
,
)
in
query
.iter_mut
()
{
// Draw background
...
...
@@ -135,11 +133,6 @@ pub(crate) fn render_texture(
.color_opt
.unwrap_or
(
cosmic_text
::
Color
::
rgb
(
0
,
0
,
0
));
let
x_offset_divisor
=
match
position
{
CosmicTextPosition
::
Center
=>
2.
,
_
=>
1.
,
};
let
draw_closure
=
|
x
,
y
,
w
,
h
,
color
|
{
for
row
in
0
..
h
as
i32
{
for
col
in
0
..
w
as
i32
{
...
...
@@ -147,7 +140,8 @@ pub(crate) fn render_texture(
&
mut
pixels
,
size
.0
.x
as
i32
,
size
.0
.y
as
i32
,
x
+
col
+
padding
.x
as
i32
-
(
x_offset
.left
/
x_offset_divisor
)
as
i32
,
// TODO: padding should draw from a user specified minumum here
x
+
col
+
padding
.x
.max
(
5.
)
as
i32
-
x_offset
.left
as
i32
,
y
+
row
+
padding
.y
as
i32
,
color
,
);
...
...
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