Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- removeAllComponents();
- var g = new Grid();
- var l1 = new Label();
- l1.text = "Dimensions:";
- l1.verticalAlign = "center";
- g.addComponent(l1);
- var hbox = new HBox();
- var w = new NumberStepper();
- w.min = 1;
- w.value = text != null ? text.width : PageEditor.GLOBAL_TEXT_PROPERTIES.width;
- w.onChange = (e) ->
- {
- if (text != null)
- {
- text.width = w.value;
- }
- else
- {
- PageEditor.GLOBAL_TEXT_PROPERTIES.width = w.value;
- }
- };
- w.styleNames = "classic-stepper";
- w.width = 55;
- hbox.addComponent(w);
- var x = new Label();
- x.text = "x";
- x.verticalAlign = "center";
- hbox.addComponent(x);
- var h = new NumberStepper();
- h.min = 1;
- h.value = text != null ? text.height : PageEditor.GLOBAL_TEXT_PROPERTIES.height;
- h.onChange = (e) ->
- {
- if (text != null)
- {
- text.height = h.value;
- }
- else
- {
- PageEditor.GLOBAL_TEXT_PROPERTIES.height = h.value;
- }
- };
- h.styleNames = "classic-stepper";
- h.width = 55;
- hbox.addComponent(h);
- g.addComponent(hbox);
- var l2 = new Label();
- l2.text = "Font Size:";
- l2.verticalAlign = "center";
- g.addComponent(l2);
- var fontSize = new NumberStepper();
- fontSize.min = 1;
- fontSize.value = text != null ? text.defaultTextFormat.size : 12;
- fontSize.onChange = (e) -> text != null ? text.defaultTextFormat.size = fontSize.value : PageEditor.GLOBAL_TEXT_FORMAT.size = fontSize.value;
- fontSize.styleNames = "classic-stepper";
- fontSize.percentWidth = 100;
- g.addComponent(fontSize);
- var l3 = new Label();
- l3.text = "Font:";
- g.addComponent(l3);
- var fonts = new DropDown();
- Main.registerFonts(fonts);
- fonts.onClick = e -> Main.registerFonts(fonts);
- fonts.selectedIndex = if (text != null) {
- if (text.defaultTextFormat.font.contains("Rubik")) 0;
- else if (text.defaultTextFormat.font.contains("sans")) 1;
- else if (text.defaultTextFormat.font.contains("serif")) 2;
- else if (text.defaultTextFormat.font.contains("typewriter")) 3;
- else 3;
- } else {
- if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("Rubik")) 0;
- else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("sans")) 1;
- else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("serif")) 2;
- else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("typewriter")) 3;
- else 3;
- };
- //fonts.percentWidth = 100;
- g.addComponent(fonts);
- addComponent(g);
Advertisement
Add Comment
Please, Sign In to add comment