@aurigma/design-atoms-model
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
41 lines • 2.09 kB
JavaScript
import { BaseItem } from "./BaseItem";
import { equals, arrayReferenceEquals, isEqual } from "../../Utils/Utils";
export class SmartItem extends BaseItem {
constructor() {
super();
this.type = SmartItem.type;
}
_copy(source, destination, generateNewIds, appropriateParentContainer) {
super._copy(source, destination, generateNewIds, appropriateParentContainer);
destination.sourceDpi = source.sourceDpi;
destination.smartObjectDpi = source.smartObjectDpi;
destination.smartObjectRectangle = source.smartObjectRectangle;
destination.smartObjectSize = source.smartObjectSize;
destination.smartObjectStorageId = source.smartObjectStorageId;
if (source.warpControlPoints != null)
destination.warpControlPoints = source.warpControlPoints.map(i => i);
if (source.projectiveTransform != null)
destination.projectiveTransform = source.projectiveTransform.map(i => i);
if (source.vectorMask != null)
destination.vectorMask = source.vectorMask.map(i => i);
return destination;
}
equals(other) {
return super.equals(other) &&
equals(this.sourceDpi, other.sourceDpi) &&
equals(this.smartObjectDpi, other.smartObjectDpi) &&
isEqual(this.smartObjectRectangle, other.smartObjectRectangle) &&
isEqual(this.smartObjectSize, other.smartObjectSize) &&
equals(this.smartObjectStorageId, other.smartObjectStorageId) &&
arrayReferenceEquals(this.warpControlPoints, other.warpControlPoints) &&
arrayReferenceEquals(this.projectiveTransform, other.projectiveTransform) &&
arrayReferenceEquals(this.vectorMask, other.vectorMask);
}
clone(generateNewIds = false, appropriateParentContainer = false) {
const item = new SmartItem();
this._copy(this, item, generateNewIds, appropriateParentContainer);
return item;
}
}
SmartItem.type = "SmartItem";
//# sourceMappingURL=SmartItem.js.map