@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 • 4.14 kB
JavaScript
import { ImageQualityViolation } from "./Violations/ImageQualityViolation";
import { SafetyLineViolation } from "./Violations/SafetyLineViolation";
import { BleedViolation } from "./Violations/BleedViolation";
import { RegionViolation } from "./Violations/RegionViolation";
import { TextCropViolation } from "./Violations/TextCropViolation";
import { ViolationService } from "./ViolationService";
import { FrontEndLogger, LogSource } from "../FrontEndLogger";
import { TextInPlaceViolation } from "./Violations/TextInPlaceViolation";
import { FontSizeViolation } from "./Violations/FontSizeViolation";
import { RasterElementsViolation } from "./Violations/RasterElementsViolation";
import { OutOfPrintAreaViolation } from "./Violations/OutOfPrintAreaViolation";
import { MaxArtworkAreaViolation } from "./Violations/MaxArtworkAreaViolation";
export class ViolationServiceFactory {
constructor(_conf, _messages, _eventManager, _productHandler, _textWhizz) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
this._conf = _conf;
this._messages = _messages;
this._eventManager = _eventManager;
this._productHandler = _productHandler;
this._textWhizz = _textWhizz;
this._renderingDpi = (_c = (_b = (_a = this._conf) === null || _a === void 0 ? void 0 : _a.qualityMeter) === null || _b === void 0 ? void 0 : _b.renderingDpi) !== null && _c !== void 0 ? _c : 300;
if (this._conf.safetyLineViolationWarningEnabled != null)
console.warn("ViolationService: safetyLineViolationWarningEnabled is deprecated. Use safetyLines.enabled instead.");
const safetyLinesEnabled = ((_d = this._conf.safetyLineViolationWarningEnabled) !== null && _d !== void 0 ? _d : true) && ((_g = (_f = (_e = this._conf) === null || _e === void 0 ? void 0 : _e.safetyLines) === null || _f === void 0 ? void 0 : _f.enabled) !== null && _g !== void 0 ? _g : true);
this._violations = [
((_h = this._conf.qualityMeter) === null || _h === void 0 ? void 0 : _h.enabled) ? new ImageQualityViolation(this._productHandler, this._conf.qualityMeter, this._messages, this._renderingDpi, this._eventManager) : null,
safetyLinesEnabled ? new SafetyLineViolation(this._productHandler, this._messages, _conf) : null,
this._conf.bleedViolationWarningEnabled ? new BleedViolation(this._productHandler, this._messages, _conf, this._textWhizz) : null,
this._conf.regionViolationWarningEnabled ? new RegionViolation(this._productHandler, this._messages) : null,
this._conf.textCropViolationWarningEnabled ? new TextCropViolation(this._productHandler, this._messages) : null,
this._conf.inPlaceNotSupportedWarningEnabled ? new TextInPlaceViolation(this._productHandler, this._messages) : null,
((_j = this._conf.minFontSize) === null || _j === void 0 ? void 0 : _j.enabled) ? new FontSizeViolation(this._productHandler, this._messages, _conf) : null,
((_k = this._conf.rasterElements) === null || _k === void 0 ? void 0 : _k.enabled) ? new RasterElementsViolation(this._messages, _conf) : null,
this._conf.outOfPrintAreaViolationWarningEnabled ? new OutOfPrintAreaViolation(this._productHandler, this._messages, _conf, this._textWhizz) : null,
this._conf.maxArtworkSizeWarningEnabled ? new MaxArtworkAreaViolation(this._productHandler, this._messages) : null,
].filter(v => v != null);
}
create() {
return new ViolationService(this._violations, this._eventManager, this._productHandler);
}
get renderingDpi() { return this._renderingDpi; }
set renderingDpi(value) {
this._renderingDpi = value;
FrontEndLogger.debugLog(`Set dpi: <span style="color: rgb(0,255,255)">${value}</span>`, LogSource.ViolationService);
const imageQualityViolation = this._violations.find(v => v instanceof ImageQualityViolation);
if (imageQualityViolation == null)
return;
imageQualityViolation.renderingDpi = value;
}
}
//# sourceMappingURL=ViolationServiceFactory.js.map