CheckBox.js 609 B

1234567891011121314151617181920212223242526272829303132
  1. class CheckBox extends UIObject
  2. {
  3. constructor(name, label = "checkbox", val = false)
  4. {
  5. super(name);
  6. this.label = label;
  7. this.P5Element = createCheckbox(label, val);
  8. this.P5Element.position(0, 0);
  9. this.setStyle(DEFAULT_STYLE);
  10. this.connectCallbacks();
  11. this.P5Element.changed(this.onChanged);
  12. }
  13. setLabel(label)
  14. {
  15. this.label = label;
  16. this.P5Element.html(label);
  17. }
  18. _onChanged()
  19. {
  20. console.log(this.P5Element.checked());
  21. }
  22. onChanged()
  23. {
  24. this.pandoraObject._onChanged();
  25. }
  26. }