AddText.js 655 B

12345678910111213141516171819202122232425262728293031323334
  1. import { mathUtil } from "../Util/MathUtil";
  2. import { textService } from "../Service/TextService";
  3. import { listenLayer } from "../ListenLayer";
  4. export default class AddText {
  5. constructor() {
  6. this.newText = null;
  7. this.center = null;
  8. this.value = null;
  9. }
  10. setCenter(value) {
  11. this.center = {};
  12. mathUtil.clonePoint(this.center, value);
  13. }
  14. setValue(value) {
  15. this.value = value;
  16. }
  17. buildText(center) {
  18. this.newText = textService.create(center);
  19. listenLayer.clear();
  20. }
  21. clear() {
  22. this.newText = null;
  23. this.center = null;
  24. this.value = null;
  25. }
  26. }
  27. const addText = new AddText();
  28. export { addText };