elit 3.5.6 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/README.md +1 -1
- package/desktop/build.rs +83 -0
- package/desktop/icon.rs +106 -0
- package/desktop/lib.rs +2 -0
- package/desktop/main.rs +235 -0
- package/desktop/native_main.rs +128 -0
- package/desktop/native_renderer/action_widgets.rs +184 -0
- package/desktop/native_renderer/app_models.rs +171 -0
- package/desktop/native_renderer/app_runtime.rs +140 -0
- package/desktop/native_renderer/container_rendering.rs +610 -0
- package/desktop/native_renderer/content_widgets.rs +634 -0
- package/desktop/native_renderer/css_models.rs +371 -0
- package/desktop/native_renderer/embedded_surfaces.rs +414 -0
- package/desktop/native_renderer/form_controls.rs +516 -0
- package/desktop/native_renderer/interaction_dispatch.rs +89 -0
- package/desktop/native_renderer/runtime_support.rs +135 -0
- package/desktop/native_renderer/utilities.rs +495 -0
- package/desktop/native_renderer/vector_drawing.rs +491 -0
- package/desktop/native_renderer.rs +4122 -0
- package/desktop/runtime/external.rs +422 -0
- package/desktop/runtime/mod.rs +67 -0
- package/desktop/runtime/quickjs.rs +106 -0
- package/desktop/window.rs +383 -0
- package/package.json +6 -3
- package/dist/build.d.mts +0 -20
- package/dist/chokidar.d.mts +0 -134
- package/dist/cli.d.mts +0 -81
- package/dist/config.d.mts +0 -254
- package/dist/coverage.d.mts +0 -85
- package/dist/database.d.mts +0 -52
- package/dist/desktop.d.mts +0 -68
- package/dist/dom.d.mts +0 -87
- package/dist/el.d.mts +0 -208
- package/dist/fs.d.mts +0 -255
- package/dist/hmr.d.mts +0 -38
- package/dist/http.d.mts +0 -169
- package/dist/https.d.mts +0 -108
- package/dist/index.d.mts +0 -13
- package/dist/mime-types.d.mts +0 -48
- package/dist/native.d.mts +0 -136
- package/dist/path.d.mts +0 -163
- package/dist/router.d.mts +0 -49
- package/dist/runtime.d.mts +0 -97
- package/dist/server-D0Dp4R5z.d.mts +0 -449
- package/dist/server.d.mts +0 -7
- package/dist/state.d.mts +0 -117
- package/dist/style.d.mts +0 -232
- package/dist/test-reporter.d.mts +0 -77
- package/dist/test-runtime.d.mts +0 -122
- package/dist/test.d.mts +0 -39
- package/dist/types.d.mts +0 -586
- package/dist/universal.d.mts +0 -21
- package/dist/ws.d.mts +0 -200
- package/dist/wss.d.mts +0 -108
- package/src/build.ts +0 -362
- package/src/chokidar.ts +0 -427
- package/src/cli.ts +0 -1162
- package/src/config.ts +0 -509
- package/src/coverage.ts +0 -1479
- package/src/database.ts +0 -1410
- package/src/desktop-auto-render.ts +0 -317
- package/src/desktop-cli.ts +0 -1533
- package/src/desktop.ts +0 -99
- package/src/dev-build.ts +0 -340
- package/src/dom.ts +0 -901
- package/src/el.ts +0 -183
- package/src/fs.ts +0 -609
- package/src/hmr.ts +0 -149
- package/src/http.ts +0 -856
- package/src/https.ts +0 -411
- package/src/index.ts +0 -16
- package/src/mime-types.ts +0 -222
- package/src/mobile-cli.ts +0 -2313
- package/src/native-background.ts +0 -444
- package/src/native-border.ts +0 -343
- package/src/native-canvas.ts +0 -260
- package/src/native-cli.ts +0 -414
- package/src/native-color.ts +0 -904
- package/src/native-estimation.ts +0 -194
- package/src/native-grid.ts +0 -590
- package/src/native-interaction.ts +0 -1289
- package/src/native-layout.ts +0 -568
- package/src/native-link.ts +0 -76
- package/src/native-render-support.ts +0 -361
- package/src/native-spacing.ts +0 -231
- package/src/native-state.ts +0 -318
- package/src/native-strings.ts +0 -46
- package/src/native-transform.ts +0 -120
- package/src/native-types.ts +0 -439
- package/src/native-typography.ts +0 -254
- package/src/native-units.ts +0 -441
- package/src/native-vector.ts +0 -910
- package/src/native.ts +0 -5606
- package/src/path.ts +0 -493
- package/src/pm-cli.ts +0 -2498
- package/src/preview-build.ts +0 -294
- package/src/render-context.ts +0 -138
- package/src/router.ts +0 -260
- package/src/runtime.ts +0 -97
- package/src/server.ts +0 -2294
- package/src/state.ts +0 -556
- package/src/style.ts +0 -1790
- package/src/test-globals.d.ts +0 -184
- package/src/test-reporter.ts +0 -609
- package/src/test-runtime.ts +0 -1359
- package/src/test.ts +0 -368
- package/src/types.ts +0 -381
- package/src/universal.ts +0 -81
- package/src/wapk-cli.ts +0 -3213
- package/src/workspace-package.ts +0 -102
- package/src/ws.ts +0 -648
- package/src/wss.ts +0 -241
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
use std::sync::Arc;
|
|
2
|
+
|
|
3
|
+
use eframe::egui::{self, Color32, CornerRadius, Margin};
|
|
4
|
+
use serde_json::{Map, Value};
|
|
5
|
+
|
|
6
|
+
#[derive(Clone, Copy, Default)]
|
|
7
|
+
pub(crate) struct DesktopPseudoState {
|
|
8
|
+
pub(crate) enabled: bool,
|
|
9
|
+
pub(crate) disabled: bool,
|
|
10
|
+
pub(crate) hovered: bool,
|
|
11
|
+
pub(crate) active: bool,
|
|
12
|
+
pub(crate) focused: bool,
|
|
13
|
+
pub(crate) focus_within: bool,
|
|
14
|
+
pub(crate) checked: bool,
|
|
15
|
+
pub(crate) selected: bool,
|
|
16
|
+
pub(crate) read_only: bool,
|
|
17
|
+
pub(crate) read_write: bool,
|
|
18
|
+
pub(crate) placeholder_shown: bool,
|
|
19
|
+
pub(crate) invalid: bool,
|
|
20
|
+
pub(crate) valid: bool,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[derive(Clone, Copy, Default)]
|
|
24
|
+
pub(crate) struct DesktopBoxEdges {
|
|
25
|
+
pub(crate) top: f32,
|
|
26
|
+
pub(crate) right: f32,
|
|
27
|
+
pub(crate) bottom: f32,
|
|
28
|
+
pub(crate) left: f32,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[derive(Clone, Copy, Default)]
|
|
32
|
+
pub(crate) struct DesktopGridTrackSpec {
|
|
33
|
+
pub(crate) fixed_width: Option<f32>,
|
|
34
|
+
pub(crate) min_width: f32,
|
|
35
|
+
pub(crate) flex_weight: f32,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#[derive(Clone, Default)]
|
|
39
|
+
pub(crate) struct DesktopGridLayoutSpec {
|
|
40
|
+
pub(crate) column_widths: Vec<f32>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[derive(Clone, Default)]
|
|
44
|
+
pub(crate) struct DesktopWidgetStateStyles {
|
|
45
|
+
pub(crate) inactive: Option<Map<String, Value>>,
|
|
46
|
+
pub(crate) hovered: Option<Map<String, Value>>,
|
|
47
|
+
pub(crate) active: Option<Map<String, Value>>,
|
|
48
|
+
pub(crate) focus: Option<Map<String, Value>>,
|
|
49
|
+
pub(crate) disabled: Option<Map<String, Value>>,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
impl DesktopBoxEdges {
|
|
53
|
+
pub(crate) fn is_zero(self) -> bool {
|
|
54
|
+
self.top.abs() < f32::EPSILON
|
|
55
|
+
&& self.right.abs() < f32::EPSILON
|
|
56
|
+
&& self.bottom.abs() < f32::EPSILON
|
|
57
|
+
&& self.left.abs() < f32::EPSILON
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub(crate) fn to_margin(self) -> Margin {
|
|
61
|
+
Margin {
|
|
62
|
+
left: round_margin_value(self.left),
|
|
63
|
+
right: round_margin_value(self.right),
|
|
64
|
+
top: round_margin_value(self.top),
|
|
65
|
+
bottom: round_margin_value(self.bottom),
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub(crate) fn average_horizontal(self) -> f32 {
|
|
70
|
+
((self.left + self.right) / 2.0).max(0.0)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub(crate) fn average_vertical(self) -> f32 {
|
|
74
|
+
((self.top + self.bottom) / 2.0).max(0.0)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#[derive(Clone, Copy, Default)]
|
|
79
|
+
pub(crate) struct DesktopCornerRadii {
|
|
80
|
+
pub(crate) top_left: f32,
|
|
81
|
+
pub(crate) top_right: f32,
|
|
82
|
+
pub(crate) bottom_right: f32,
|
|
83
|
+
pub(crate) bottom_left: f32,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#[derive(Clone, Copy, PartialEq, Eq)]
|
|
87
|
+
pub(crate) enum DesktopFontVariant {
|
|
88
|
+
Regular,
|
|
89
|
+
Bold,
|
|
90
|
+
Italic,
|
|
91
|
+
BoldItalic,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
impl DesktopFontVariant {
|
|
95
|
+
pub(crate) fn suffix(self) -> &'static str {
|
|
96
|
+
match self {
|
|
97
|
+
Self::Regular => "regular",
|
|
98
|
+
Self::Bold => "bold",
|
|
99
|
+
Self::Italic => "italic",
|
|
100
|
+
Self::BoldItalic => "bold-italic",
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#[derive(Clone, Default)]
|
|
106
|
+
pub(crate) struct DesktopFontFaces {
|
|
107
|
+
pub(crate) regular: Option<Arc<str>>,
|
|
108
|
+
pub(crate) bold: Option<Arc<str>>,
|
|
109
|
+
pub(crate) italic: Option<Arc<str>>,
|
|
110
|
+
pub(crate) bold_italic: Option<Arc<str>>,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
impl DesktopFontFaces {
|
|
114
|
+
pub(crate) fn set(&mut self, variant: DesktopFontVariant, family_name: Arc<str>) {
|
|
115
|
+
match variant {
|
|
116
|
+
DesktopFontVariant::Regular => self.regular = Some(family_name),
|
|
117
|
+
DesktopFontVariant::Bold => self.bold = Some(family_name),
|
|
118
|
+
DesktopFontVariant::Italic => self.italic = Some(family_name),
|
|
119
|
+
DesktopFontVariant::BoldItalic => self.bold_italic = Some(family_name),
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
pub(crate) fn has_any(&self) -> bool {
|
|
124
|
+
self.regular.is_some() || self.bold.is_some() || self.italic.is_some() || self.bold_italic.is_some()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
pub(crate) fn resolve_font_family(&self, want_bold: bool, want_italic: bool) -> Option<(egui::FontFamily, bool, bool)> {
|
|
128
|
+
let resolved = if want_bold && want_italic {
|
|
129
|
+
self.bold_italic
|
|
130
|
+
.as_ref()
|
|
131
|
+
.map(|family| (family.clone(), true, true))
|
|
132
|
+
.or_else(|| self.bold.as_ref().map(|family| (family.clone(), true, false)))
|
|
133
|
+
.or_else(|| self.italic.as_ref().map(|family| (family.clone(), false, true)))
|
|
134
|
+
.or_else(|| self.regular.as_ref().map(|family| (family.clone(), false, false)))
|
|
135
|
+
} else if want_bold {
|
|
136
|
+
self.bold
|
|
137
|
+
.as_ref()
|
|
138
|
+
.map(|family| (family.clone(), true, false))
|
|
139
|
+
.or_else(|| self.regular.as_ref().map(|family| (family.clone(), false, false)))
|
|
140
|
+
} else if want_italic {
|
|
141
|
+
self.italic
|
|
142
|
+
.as_ref()
|
|
143
|
+
.map(|family| (family.clone(), false, true))
|
|
144
|
+
.or_else(|| self.regular.as_ref().map(|family| (family.clone(), false, false)))
|
|
145
|
+
} else {
|
|
146
|
+
self.regular
|
|
147
|
+
.as_ref()
|
|
148
|
+
.map(|family| (family.clone(), false, false))
|
|
149
|
+
.or_else(|| self.bold.as_ref().map(|family| (family.clone(), true, false)))
|
|
150
|
+
.or_else(|| self.italic.as_ref().map(|family| (family.clone(), false, true)))
|
|
151
|
+
.or_else(|| self.bold_italic.as_ref().map(|family| (family.clone(), true, true)))
|
|
152
|
+
}?;
|
|
153
|
+
|
|
154
|
+
Some((egui::FontFamily::Name(resolved.0), resolved.1, resolved.2))
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
impl DesktopCornerRadii {
|
|
159
|
+
pub(crate) fn to_corner_radius(self) -> CornerRadius {
|
|
160
|
+
CornerRadius {
|
|
161
|
+
nw: round_corner_value(self.top_left),
|
|
162
|
+
ne: round_corner_value(self.top_right),
|
|
163
|
+
se: round_corner_value(self.bottom_right),
|
|
164
|
+
sw: round_corner_value(self.bottom_left),
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
pub(crate) fn round_margin_value(value: f32) -> i8 {
|
|
170
|
+
value.round().clamp(i8::MIN as f32, i8::MAX as f32) as i8
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
pub(crate) fn round_corner_value(value: f32) -> u8 {
|
|
174
|
+
value.round().clamp(0.0, u8::MAX as f32) as u8
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#[derive(Clone, Copy)]
|
|
178
|
+
pub(crate) struct CssMeasureContext {
|
|
179
|
+
pub(crate) basis: Option<f32>,
|
|
180
|
+
pub(crate) viewport_width: Option<f32>,
|
|
181
|
+
pub(crate) viewport_height: Option<f32>,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
impl CssMeasureContext {
|
|
185
|
+
pub(crate) fn from_basis(basis: Option<f32>) -> Self {
|
|
186
|
+
Self {
|
|
187
|
+
basis,
|
|
188
|
+
viewport_width: basis,
|
|
189
|
+
viewport_height: basis,
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
195
|
+
pub(crate) struct DesktopGradientStop {
|
|
196
|
+
pub(crate) position: f32,
|
|
197
|
+
pub(crate) color: Color32,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#[derive(Clone, Debug, PartialEq)]
|
|
201
|
+
pub(crate) struct DesktopLinearGradient {
|
|
202
|
+
pub(crate) angle_deg: f32,
|
|
203
|
+
pub(crate) stops: Vec<DesktopGradientStop>,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
#[derive(Clone, Debug, PartialEq)]
|
|
207
|
+
pub(crate) struct DesktopRadialGradient {
|
|
208
|
+
pub(crate) stops: Vec<DesktopGradientStop>,
|
|
209
|
+
/// horizontal center as fraction of bounding box width (0.0 = left, 0.5 = center, 1.0 = right)
|
|
210
|
+
pub(crate) center_x: f32,
|
|
211
|
+
/// vertical center as fraction of bounding box height (0.0 = top, 0.5 = center, 1.0 = bottom)
|
|
212
|
+
pub(crate) center_y: f32,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
#[derive(Clone, Debug, Default)]
|
|
216
|
+
pub(crate) struct DesktopCssFilter {
|
|
217
|
+
pub(crate) brightness: f32,
|
|
218
|
+
pub(crate) contrast: f32,
|
|
219
|
+
pub(crate) grayscale: f32,
|
|
220
|
+
pub(crate) invert: f32,
|
|
221
|
+
pub(crate) sepia: f32,
|
|
222
|
+
pub(crate) saturate: f32,
|
|
223
|
+
pub(crate) hue_rotate_deg: f32,
|
|
224
|
+
pub(crate) blur: f32,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
impl DesktopCssFilter {
|
|
228
|
+
pub(crate) fn new() -> Self {
|
|
229
|
+
Self {
|
|
230
|
+
brightness: 1.0,
|
|
231
|
+
contrast: 1.0,
|
|
232
|
+
grayscale: 0.0,
|
|
233
|
+
invert: 0.0,
|
|
234
|
+
sepia: 0.0,
|
|
235
|
+
saturate: 1.0,
|
|
236
|
+
hue_rotate_deg: 0.0,
|
|
237
|
+
blur: 0.0,
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
#[allow(dead_code)]
|
|
242
|
+
pub(crate) fn has_color_effect(&self) -> bool {
|
|
243
|
+
(self.brightness - 1.0).abs() > 0.001
|
|
244
|
+
|| (self.contrast - 1.0).abs() > 0.001
|
|
245
|
+
|| self.grayscale > 0.001
|
|
246
|
+
|| self.invert > 0.001
|
|
247
|
+
|| self.sepia > 0.001
|
|
248
|
+
|| (self.saturate - 1.0).abs() > 0.001
|
|
249
|
+
|| self.hue_rotate_deg.abs() > 0.5
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
pub(crate) fn apply(&self, color: Color32) -> Color32 {
|
|
253
|
+
let r = color.r() as f32 / 255.0;
|
|
254
|
+
let g = color.g() as f32 / 255.0;
|
|
255
|
+
let b = color.b() as f32 / 255.0;
|
|
256
|
+
let a = color.a() as f32 / 255.0;
|
|
257
|
+
|
|
258
|
+
let (mut r, mut g, mut b) = (r * self.brightness, g * self.brightness, b * self.brightness);
|
|
259
|
+
|
|
260
|
+
let contrast = self.contrast;
|
|
261
|
+
r = (r - 0.5) * contrast + 0.5;
|
|
262
|
+
g = (g - 0.5) * contrast + 0.5;
|
|
263
|
+
b = (b - 0.5) * contrast + 0.5;
|
|
264
|
+
|
|
265
|
+
let luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
266
|
+
r += (luminance - r) * self.grayscale;
|
|
267
|
+
g += (luminance - g) * self.grayscale;
|
|
268
|
+
b += (luminance - b) * self.grayscale;
|
|
269
|
+
|
|
270
|
+
let sepia = self.sepia;
|
|
271
|
+
let sr = r * (0.393 + 0.607 * (1.0 - sepia))
|
|
272
|
+
+ g * (0.769 - 0.769 * (1.0 - sepia))
|
|
273
|
+
+ b * (0.189 - 0.189 * (1.0 - sepia));
|
|
274
|
+
let sg = r * (0.349 - 0.349 * (1.0 - sepia))
|
|
275
|
+
+ g * (0.686 + 0.314 * (1.0 - sepia))
|
|
276
|
+
+ b * (0.168 - 0.168 * (1.0 - sepia));
|
|
277
|
+
let sb = r * (0.272 - 0.272 * (1.0 - sepia))
|
|
278
|
+
+ g * (0.534 - 0.534 * (1.0 - sepia))
|
|
279
|
+
+ b * (0.131 + 0.869 * (1.0 - sepia));
|
|
280
|
+
r = sr;
|
|
281
|
+
g = sg;
|
|
282
|
+
b = sb;
|
|
283
|
+
|
|
284
|
+
let saturated_luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
285
|
+
r = saturated_luminance + (r - saturated_luminance) * self.saturate;
|
|
286
|
+
g = saturated_luminance + (g - saturated_luminance) * self.saturate;
|
|
287
|
+
b = saturated_luminance + (b - saturated_luminance) * self.saturate;
|
|
288
|
+
|
|
289
|
+
r += (1.0 - 2.0 * r) * self.invert;
|
|
290
|
+
g += (1.0 - 2.0 * g) * self.invert;
|
|
291
|
+
b += (1.0 - 2.0 * b) * self.invert;
|
|
292
|
+
|
|
293
|
+
if self.hue_rotate_deg.abs() > 0.5 {
|
|
294
|
+
let radians = self.hue_rotate_deg.to_radians();
|
|
295
|
+
let cos_a = radians.cos();
|
|
296
|
+
let sin_a = radians.sin();
|
|
297
|
+
let rotated_r = r * (0.213 + cos_a * 0.787 - sin_a * 0.213)
|
|
298
|
+
+ g * (0.715 - cos_a * 0.715 - sin_a * 0.715)
|
|
299
|
+
+ b * (0.072 - cos_a * 0.072 + sin_a * 0.928);
|
|
300
|
+
let rotated_g = r * (0.213 - cos_a * 0.213 + sin_a * 0.143)
|
|
301
|
+
+ g * (0.715 + cos_a * 0.285 + sin_a * 0.140)
|
|
302
|
+
+ b * (0.072 - cos_a * 0.072 - sin_a * 0.283);
|
|
303
|
+
let rotated_b = r * (0.213 - cos_a * 0.213 - sin_a * 0.787)
|
|
304
|
+
+ g * (0.715 - cos_a * 0.715 + sin_a * 0.715)
|
|
305
|
+
+ b * (0.072 + cos_a * 0.928 + sin_a * 0.072);
|
|
306
|
+
r = rotated_r;
|
|
307
|
+
g = rotated_g;
|
|
308
|
+
b = rotated_b;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
let to_u8 = |value: f32| (value.clamp(0.0, 1.0) * 255.0).round() as u8;
|
|
312
|
+
Color32::from_rgba_unmultiplied(to_u8(r), to_u8(g), to_u8(b), (a * 255.0).round() as u8)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
#[derive(Clone, Debug, Default)]
|
|
317
|
+
pub(crate) struct DesktopCssTransform {
|
|
318
|
+
pub(crate) translate_x: f32,
|
|
319
|
+
pub(crate) translate_y: f32,
|
|
320
|
+
pub(crate) scale_x: f32,
|
|
321
|
+
pub(crate) scale_y: f32,
|
|
322
|
+
pub(crate) rotate_deg: f32,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
impl DesktopCssTransform {
|
|
326
|
+
pub(crate) fn identity() -> Self {
|
|
327
|
+
Self {
|
|
328
|
+
translate_x: 0.0,
|
|
329
|
+
translate_y: 0.0,
|
|
330
|
+
scale_x: 1.0,
|
|
331
|
+
scale_y: 1.0,
|
|
332
|
+
rotate_deg: 0.0,
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
#[allow(dead_code)]
|
|
337
|
+
pub(crate) fn has_any(&self) -> bool {
|
|
338
|
+
self.translate_x.abs() > f32::EPSILON
|
|
339
|
+
|| self.translate_y.abs() > f32::EPSILON
|
|
340
|
+
|| (self.scale_x - 1.0).abs() > 0.001
|
|
341
|
+
|| (self.scale_y - 1.0).abs() > 0.001
|
|
342
|
+
|| self.rotate_deg.abs() > 0.01
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
#[derive(Clone, Debug)]
|
|
347
|
+
pub(crate) struct DesktopTextShadow {
|
|
348
|
+
pub(crate) offset_x: f32,
|
|
349
|
+
pub(crate) offset_y: f32,
|
|
350
|
+
#[allow(dead_code)]
|
|
351
|
+
pub(crate) blur_radius: f32,
|
|
352
|
+
pub(crate) color: Color32,
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#[derive(Default, Clone, Copy, Debug, PartialEq, Eq)]
|
|
356
|
+
pub(crate) struct DesktopOverflowBehavior {
|
|
357
|
+
pub(crate) horizontal_scroll: bool,
|
|
358
|
+
pub(crate) vertical_scroll: bool,
|
|
359
|
+
pub(crate) horizontal_clip: bool,
|
|
360
|
+
pub(crate) vertical_clip: bool,
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
impl DesktopOverflowBehavior {
|
|
364
|
+
pub(crate) fn has_scroll(self) -> bool {
|
|
365
|
+
self.horizontal_scroll || self.vertical_scroll
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
pub(crate) fn has_clip(self) -> bool {
|
|
369
|
+
self.horizontal_clip || self.vertical_clip
|
|
370
|
+
}
|
|
371
|
+
}
|