@bitbybit-dev/jscad-worker
Version:
Bit By Bit Developers JSCAD Based CAD Library to Program Geometry Via WebWorker
32 lines (31 loc) • 1.56 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**
* Contains functions for colorizing objects
*/
export class JSCADColors {
constructor(jscadWorkerManager) {
this.jscadWorkerManager = jscadWorkerManager;
}
/**
* Colorizes geometry of jscad. If geometry is in the array it will colorize all items and return them. If geometry is a single item it will return a single item.
* Keep in mind that colorized geometry in jscad will always be drawn in that color even if you try to change it via draw options.
* @param inputs contain geometry and hex color
* @returns Colorized geometry of jsacd
* @group colorize
* @shortname colorize geometry
* @drawable true
*/
colorize(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.jscadWorkerManager.genericCallToWorkerPromise("colors.colorize", inputs);
});
}
}