// TextElement.js
import BaseElement from './BaseElement.js';

class TextElement extends BaseElement {
  constructor(text, x, y, engineId) {
    super('div', engineId);
    this.element.innerText = text;
    this.setPosition(x, y);
    this.element.setAttribute('data-text-id', engineId);
    // 确保文本元素可见
    this.element.style.zIndex = '100';
    this.element.style.color = 'black';
    this.element.style.fontSize = '16px';

    // 文本特有方法
    this.set = text => (this.element.innerText = text);
    this.setColor = color => (this.element.style.color = color);
    this.setFont = font => (this.element.style.font = font);
  }
}

export default TextElement;
export { TextElement };