Guest User

Untitled

a guest
Aug 3rd, 2022
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 2.38 KB | None | 0 0
  1. removeAllComponents();
  2.         var g = new Grid();
  3.  
  4.         var l1 = new Label();
  5.         l1.text = "Dimensions:";
  6.         l1.verticalAlign = "center";
  7.         g.addComponent(l1);
  8.         var hbox = new HBox();
  9.         var w = new NumberStepper();
  10.         w.min = 1;
  11.         w.value = text != null ? text.width : PageEditor.GLOBAL_TEXT_PROPERTIES.width;
  12.         w.onChange = (e) ->
  13.         {
  14.             if (text != null)
  15.             {
  16.                 text.width = w.value;
  17.             }
  18.             else
  19.             {
  20.                 PageEditor.GLOBAL_TEXT_PROPERTIES.width = w.value;
  21.             }
  22.         };
  23.         w.styleNames = "classic-stepper";
  24.         w.width = 55;
  25.         hbox.addComponent(w);
  26.         var x = new Label();
  27.         x.text = "x";
  28.         x.verticalAlign = "center";
  29.         hbox.addComponent(x);
  30.         var h = new NumberStepper();
  31.         h.min = 1;
  32.         h.value = text != null ? text.height : PageEditor.GLOBAL_TEXT_PROPERTIES.height;
  33.         h.onChange = (e) ->
  34.         {
  35.             if (text != null)
  36.             {
  37.                 text.height = h.value;
  38.             }
  39.             else
  40.             {
  41.                 PageEditor.GLOBAL_TEXT_PROPERTIES.height = h.value;
  42.             }
  43.         };
  44.         h.styleNames = "classic-stepper";
  45.         h.width = 55;
  46.         hbox.addComponent(h);
  47.         g.addComponent(hbox);
  48.  
  49.         var l2 = new Label();
  50.         l2.text = "Font Size:";
  51.         l2.verticalAlign = "center";
  52.         g.addComponent(l2);
  53.         var fontSize = new NumberStepper();
  54.         fontSize.min = 1;
  55.         fontSize.value = text != null ? text.defaultTextFormat.size : 12;
  56.         fontSize.onChange = (e) -> text != null ? text.defaultTextFormat.size = fontSize.value : PageEditor.GLOBAL_TEXT_FORMAT.size = fontSize.value;
  57.         fontSize.styleNames = "classic-stepper";
  58.         fontSize.percentWidth = 100;
  59.         g.addComponent(fontSize);
  60.  
  61.         var l3 = new Label();
  62.         l3.text = "Font:";
  63.         g.addComponent(l3);
  64.         var fonts = new DropDown();
  65.         Main.registerFonts(fonts);
  66.         fonts.onClick = e -> Main.registerFonts(fonts);
  67.         fonts.selectedIndex = if (text != null) {
  68.             if (text.defaultTextFormat.font.contains("Rubik")) 0;
  69.             else if (text.defaultTextFormat.font.contains("sans")) 1;
  70.             else if (text.defaultTextFormat.font.contains("serif")) 2;
  71.             else if (text.defaultTextFormat.font.contains("typewriter")) 3;
  72.             else 3;
  73.         } else {
  74.             if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("Rubik")) 0;
  75.             else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("sans")) 1;
  76.             else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("serif")) 2;
  77.             else if (PageEditor.GLOBAL_TEXT_FORMAT.font.contains("typewriter")) 3;
  78.             else 3;
  79.         };
  80.         //fonts.percentWidth = 100;
  81.         g.addComponent(fonts);
  82.  
  83.         addComponent(g);
Advertisement
Add Comment
Please, Sign In to add comment