@visactor/vtable
Version:
canvas table width high performance
22 lines (18 loc) • 1.72 kB
JavaScript
import { Image } from "./../../vrender";
import { isArray, isString } from "@visactor/vutils";
import * as registerIcons from "../../icons";
export class Icon extends Image {
constructor(options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
let cache;
if (isString(options.iconName)) {
cache = registerIcons.get()[options.iconName], cache && (options.width = null !== (_a = options.width) && void 0 !== _a ? _a : cache.width,
options.height = null !== (_b = options.height) && void 0 !== _b ? _b : cache.height,
options.svg = cache.svg, options.cursor = cache.cursor);
}
options.svg && (options.image = options.svg);
const isPaddingNumber = isArray(options.boundsPadding), padding = [ null !== (_d = null !== (_c = options.marginTop) && void 0 !== _c ? _c : isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) && void 0 !== _d ? _d : 0, null !== (_f = null !== (_e = options.marginRight) && void 0 !== _e ? _e : isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) && void 0 !== _f ? _f : 0, null !== (_j = null !== (_g = options.marginBottom) && void 0 !== _g ? _g : isPaddingNumber ? null !== (_h = options.boundsPadding[2]) && void 0 !== _h ? _h : options.boundsPadding[0] : options.boundsPadding) && void 0 !== _j ? _j : 0, null !== (_m = null !== (_k = options.marginLeft) && void 0 !== _k ? _k : isPaddingNumber ? null !== (_l = options.boundsPadding[3]) && void 0 !== _l ? _l : options.boundsPadding[1] : options.boundsPadding) && void 0 !== _m ? _m : 0 ];
options.boundsPadding = padding, super(options), this.cache = cache;
}
}
//# sourceMappingURL=icon.js.map