import { r as registerInstance, c as createEvent, h, g as getElement } from './index-c948674f.js';

const indexCss = "taro-canvas-core{display:block;position:relative;width:300px;height:150px}";

const LONG_TAP_DELAY = 500;
const Canvas = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.onLongTap = createEvent(this, "longtap", 7);
    this.onTouchStart = () => {
      this.timer = setTimeout(() => {
        this.onLongTap.emit();
      }, LONG_TAP_DELAY);
    };
    this.onTouchMove = () => {
      clearTimeout(this.timer);
    };
    this.onTouchEnd = () => {
      clearTimeout(this.timer);
    };
    this.canvasId = undefined;
    this.nativeProps = {};
  }
  render() {
    const { canvasId, nativeProps } = this;
    return (h("canvas", Object.assign({ "canvas-id": canvasId, style: {
        width: '100%',
        height: '100%'
      }, onTouchStart: this.onTouchStart, onTouchMove: this.onTouchMove, onTouchEnd: this.onTouchEnd }, nativeProps)));
  }
  get el() { return getElement(this); }
};
Canvas.style = indexCss;

export { Canvas as taro_canvas_core };

//# sourceMappingURL=taro-canvas-core.entry.js.map