vim-web 0.5.0-dev.7 → 0.5.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,11 +24,11 @@ export declare class ColorManager {
|
|
|
24
24
|
getColor(color: THREE.Color): Promise<RemoteColor | undefined>;
|
|
25
25
|
/**
|
|
26
26
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
27
|
-
* @param colors - Array of
|
|
27
|
+
* @param colors - Array of color values or undefined for no color
|
|
28
28
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
29
29
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
30
30
|
*/
|
|
31
|
-
getColors(colors: THREE.Color[]): Promise<RemoteColor[]>;
|
|
31
|
+
getColors(colors: (THREE.Color | undefined)[]): Promise<RemoteColor[]>;
|
|
32
32
|
/**
|
|
33
33
|
* Retrieves a color instance by its unique identifier.
|
|
34
34
|
* @param id - The unique identifier of the color
|
|
@@ -38,7 +38,7 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
38
38
|
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
39
39
|
getColor(elementIndex: number): THREE.Color | undefined;
|
|
40
40
|
setColor(elementIndex: number[], color: THREE.Color | undefined): Promise<void>;
|
|
41
|
-
setColors(
|
|
41
|
+
setColors(elements: number[], color: (THREE.Color | undefined)[]): Promise<void>;
|
|
42
42
|
private applyColor;
|
|
43
43
|
clearColor(elements: number[] | 'all'): void;
|
|
44
44
|
reapplyColors(): void;
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -58384,7 +58384,7 @@ void main() {
|
|
|
58384
58384
|
}
|
|
58385
58385
|
/**
|
|
58386
58386
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
58387
|
-
* @param colors - Array of
|
|
58387
|
+
* @param colors - Array of color values or undefined for no color
|
|
58388
58388
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
58389
58389
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
58390
58390
|
*/
|
|
@@ -58394,15 +58394,23 @@ void main() {
|
|
|
58394
58394
|
const toCreate = [];
|
|
58395
58395
|
for (let i2 = 0; i2 < colors.length; i2++) {
|
|
58396
58396
|
const color = colors[i2];
|
|
58397
|
-
|
|
58398
|
-
|
|
58399
|
-
|
|
58400
|
-
}
|
|
58397
|
+
if (color === void 0) {
|
|
58398
|
+
result[i2] = void 0;
|
|
58399
|
+
continue;
|
|
58400
|
+
}
|
|
58401
|
+
const hex = (color == null ? void 0 : color.getHex()) ?? -1;
|
|
58402
|
+
const remoteColor = this._hexToColor.get(hex);
|
|
58403
|
+
if (remoteColor) {
|
|
58404
|
+
result[i2] = remoteColor;
|
|
58405
|
+
continue;
|
|
58406
|
+
}
|
|
58407
|
+
const indices = hexToIndices.get(hex);
|
|
58408
|
+
if (indices) {
|
|
58401
58409
|
hexToIndices.get(hex).push(i2);
|
|
58402
|
-
|
|
58403
|
-
toCreate.push(color);
|
|
58404
|
-
hexToIndices.set(hex, [i2]);
|
|
58410
|
+
continue;
|
|
58405
58411
|
}
|
|
58412
|
+
toCreate.push(color);
|
|
58413
|
+
hexToIndices.set(hex, [i2]);
|
|
58406
58414
|
}
|
|
58407
58415
|
const remoteColors = await this._createColors(toCreate);
|
|
58408
58416
|
if (!remoteColors) return void 0;
|
|
@@ -61034,22 +61042,22 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61034
61042
|
const colors = new Array(elementIndex.length).fill(color);
|
|
61035
61043
|
this.applyColor(elementIndex, colors);
|
|
61036
61044
|
}
|
|
61037
|
-
async setColors(
|
|
61038
|
-
if (color.length !==
|
|
61039
|
-
throw new Error("Color and
|
|
61045
|
+
async setColors(elements, color) {
|
|
61046
|
+
if (color.length !== elements.length) {
|
|
61047
|
+
throw new Error("Color and elements length must be equal");
|
|
61040
61048
|
}
|
|
61041
|
-
this.applyColor(
|
|
61049
|
+
this.applyColor(elements, color);
|
|
61042
61050
|
}
|
|
61043
|
-
applyColor(
|
|
61051
|
+
applyColor(elements, color) {
|
|
61044
61052
|
for (let i2 = 0; i2 < color.length; i2++) {
|
|
61045
61053
|
const c = color[i2];
|
|
61046
|
-
const
|
|
61054
|
+
const element = elements[i2];
|
|
61047
61055
|
if (c === void 0) {
|
|
61048
|
-
this._elementColors.delete(
|
|
61056
|
+
this._elementColors.delete(element);
|
|
61049
61057
|
} else {
|
|
61050
|
-
this._elementColors.set(
|
|
61058
|
+
this._elementColors.set(element, c);
|
|
61051
61059
|
}
|
|
61052
|
-
this._updatedColors.add(
|
|
61060
|
+
this._updatedColors.add(element);
|
|
61053
61061
|
}
|
|
61054
61062
|
this.scheduleColorUpdate();
|
|
61055
61063
|
}
|
|
@@ -61085,11 +61093,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61085
61093
|
this._renderer.notifySceneUpdated();
|
|
61086
61094
|
}
|
|
61087
61095
|
async updateRemoteColors() {
|
|
61088
|
-
const
|
|
61089
|
-
const colors =
|
|
61096
|
+
const elements = Array.from(this._updatedColors);
|
|
61097
|
+
const colors = elements.map((n) => this._elementColors.get(n));
|
|
61090
61098
|
const remoteColors = await this._colors.getColors(colors);
|
|
61091
61099
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61092
|
-
this._rpc.RPCSetMaterialOverridesForElements(this._handle,
|
|
61100
|
+
this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, colorIds);
|
|
61093
61101
|
this._updatedColors.clear();
|
|
61094
61102
|
}
|
|
61095
61103
|
}
|