Repository navigation
Expand file tree
/
Copy pathcontrol.rs
More file actions
53 lines (50 loc) · 1.57 KB
/
Copy pathcontrol.rs
File metadata and controls
53 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Abstract base for UI elements: size, color, font size.
use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
type_name: "Control",
description: "Abstract base for UI elements: size, color, and font size.",
inherits: Some("Node2D"),
abstract_class: true,
props: PROPS,
};
pub static PROPS: &[PropSchema] = &[
PropSchema {
key: "size",
label: "Size",
doc: "Bounding box size in world units.",
default_value: DefaultPropVal::Vec2(100.0, 40.0),
hint: PropHint::Vec2 { speed: 1.0 },
read_only: false,
},
PropSchema {
key: "color",
label: "Color",
doc: "Fill color as sRGB hex with alpha, e.g. `#ffffffff`.",
default_value: DefaultPropVal::Color([255, 255, 255, 255]),
hint: PropHint::Color,
read_only: false,
},
PropSchema {
key: "font_size",
label: "Font Size",
doc: "Text size in world units; scales with camera zoom.",
default_value: DefaultPropVal::Num(16.0),
hint: PropHint::Num {
speed: 1.0,
min: 6.0,
max: 128.0,
},
read_only: false,
},
PropSchema {
key: "font",
label: "Font",
doc: "Path to a .ttf or .otf font file; empty uses the project default font.",
default_value: DefaultPropVal::Str(""),
hint: PropHint::Asset {
filter: &["ttf", "otf"],
},
read_only: false,
},
];