1234567891011121314151617181920212223242526272829303132333435363738 |
- import { mathUtil } from "../Util/MathUtil.js";
- import VectorType from "../enum/VectorType.js";
- import Geometry from "./Geometry";
- export default class Img extends Geometry {
- constructor(src, vectorId) {
- super();
- this.src = null;
- this.angle = 0;
- this.display = true;
- this.center = null;
- this.imageData = null;
- this.geoType = VectorType.Img;
- this.setId(vectorId);
- this.setSrc(src);
- }
- setAngle(value) {
- this.angle = value;
- }
- setSrc(src) {
- this.src = src;
- }
- setImageData() {
- return new Promise((resolve, reject) => {
- this.imageData = new Image();
- this.imageData.src = this.src;
- this.imageData.onload = function () {
- resolve();
- };
- this.imageData.onerror = function () {
- reject();
- };
- });
- }
- }
|