@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
51 lines • 1.85 kB
JavaScript
import { BaseInputHandler } from "./BaseInputHandler";
import { Graphics } from "../../Graphics";
import { RotatedRectangleF } from "@aurigma/design-atoms-model/Math";
export class TestInputHandler extends BaseInputHandler {
constructor(inputManager, _canvas) {
super(inputManager);
this._canvas = _canvas;
this._rectSize = 10;
this._createRect = (pt) => {
return new RotatedRectangleF(pt.x, pt.y, this._rectSize, this._rectSize);
};
}
_updateCtx() {
this._ctx = this._canvas._canvasRenderer._getScaledContext(this._canvas.surfaceCanvas);
}
async _onClick(params) {
this._updateCtx();
Graphics.fillRectangle(this._ctx, this._createRect(params.workspace), "red");
this._ctx.restore();
}
async _onDoubleClick(params) {
this._updateCtx();
Graphics.fillRectangle(this._ctx, this._createRect(params.workspace), "green");
this._ctx.restore();
}
async _onKey(params) {
}
async _onLongTap(params) {
this._updateCtx();
Graphics.fillRectangle(this._ctx, this._createRect(params.workspace), "yellow");
this._ctx.restore();
}
async _onMove(params) {
this._updateCtx();
Graphics.fillRectangle(this._ctx, this._createRect(params.startWorkspace), "cyan");
Graphics.fillRectangle(this._ctx, this._createRect(params.workspace), "magenta");
this._ctx.restore();
}
async _onPointerDown(params) {
this._updateCtx();
Graphics.fillRectangle(this._ctx, this._createRect(params.workspace), "blue");
this._ctx.restore();
}
async _onTransform(params) {
}
async _onWheel(params) {
}
async _onHover(params) {
}
}
//# sourceMappingURL=TestInputHandler.js.map