@visactor/vtable
Version:
canvas table width high performance
31 lines (27 loc) • 1.56 kB
JavaScript
import { createRect } from "./../../vrender";
import { updateAllSelectComponent } from "../../scenegraph/select/update-select-border";
export function deletaCustomSelectRanges(state) {
const {customSelectedRangeComponents: customSelectedRangeComponents} = state.table.scenegraph;
customSelectedRangeComponents.forEach(((selectComp, key) => {
selectComp.rect.delete();
})), customSelectedRangeComponents.clear(), state.select.customSelectRanges = [];
}
export function addCustomSelectRanges(customSelectRanges, state) {
const {customSelectedRangeComponents: customSelectedRangeComponents} = state.table.scenegraph;
customSelectRanges.forEach((customRange => {
var _a, _b, _c, _d;
const {range: range, style: style} = customRange, rect = createRect({
fill: null !== (_a = style.cellBgColor) && void 0 !== _a && _a,
stroke: null !== (_b = style.cellBorderColor) && void 0 !== _b && _b,
lineWidth: null !== (_c = style.cellBorderLineWidth) && void 0 !== _c ? _c : 0,
lineDash: null !== (_d = style.cellBorderLineDash) && void 0 !== _d ? _d : [],
pickable: !1
});
customSelectedRangeComponents.set(`${range.start.col}-${range.start.row}-${range.end.col}-${range.end.row}`, {
rect: rect,
role: "body"
});
})), state.select.customSelectRanges = customSelectRanges, updateAllSelectComponent(state.table.scenegraph),
state.table.scenegraph.updateNextFrame();
}
//# sourceMappingURL=custom-select.js.map