Skip to content

Commit

Permalink
idk - some combination of working over ssh and working late screwed
Browse files Browse the repository at this point in the history
things up
  • Loading branch information
dkoes committed Aug 31, 2024
1 parent 4164b52 commit eb030b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface LabelSpec {
backgroundOpacity?: number;
/** coordinates for label */
position?: XYZ;
/** x,y pixel offset of label from position */
/** x,y,z pixel offset of label from position; for screen labels z is a z-index */
screenOffset?: Vector2;
/** always put labels in front of model */
inFront?: boolean;
Expand Down
12 changes: 5 additions & 7 deletions src/WebGL/SpritePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,11 @@ export class SpritePlugin {
let sprites: unknown[] = [];
scene?.__webglSprites?.forEach((sprite) => {
//depthTest is false for inFront labels
if (!sprite.hidden) {
if (inFront && sprite.material.depthTest == false) {
sprites.push(sprite);
} else if (!inFront && sprite.material.depthTest) {
sprites.push(sprite);
}
}
if (inFront && sprite.material.depthTest == false) {
sprites.push(sprite);
} else if (!inFront && sprite.material.depthTest) {
sprites.push(sprite);
}
});

let nSprites = sprites.length;
Expand Down
4 changes: 2 additions & 2 deletions tests/auto/tests/hidelabel.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@


let l = viewer.addLabel("Hello World",{position:{x:0,y:0,z:0},useScreen: true, fontSize: 64});
let l = viewer.addLabel("Hello World",{position:{x:0,y:0,z:1},useScreen: true, fontSize: 64});
let l2 = viewer.addLabel("Hello World",{position:{x:10,y:0,z:0},backgroundColor: "blue",useScreen: true, fontSize: 64});
let l3 = viewer.addLabel("Hello World",{position:{x:10,y:100,z:0},backgroundColor: "yellow",useScreen: true, fontSize: 64});

l.hide();
l3.hide();
viewer.render( );
l3.show();
viewer.render();
viewer.render();

0 comments on commit eb030b7

Please sign in to comment.