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

class HtmlElement extends BaseElement {
  constructor(html, x, y, engineId) {
    super('div', engineId);
    this.element.innerHTML = html;
    this.setPosition(x, y);
    this.element.setAttribute('data-html-id', engineId);

    // HTML特有方法
    this.set = html => (this.element.innerHTML = html);
    this.get = () => this.element.innerHTML;
    this.getSize = () => {
      const rect = this.element.getBoundingClientRect();
      return { width: rect.width, height: rect.height };
    };
  }
}

export default HtmlElement;
export { HtmlElement };