Skip to content

Commit

Permalink
Files hadn't been saved for last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoes committed Aug 31, 2024
1 parent cc817a8 commit 4164b52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ export class Label {
return this.stylespec;
}

hide() {
/** Hide this label. */
public hide() {
this.sprite.visible = false;
}

show() {
/** Show a hidden label. */
public show() {

this.sprite.visible = true;
}
Expand Down
14 changes: 8 additions & 6 deletions src/WebGL/SpritePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ export class SpritePlugin {
let sprites: unknown[] = [];
scene?.__webglSprites?.forEach((sprite) => {
//depthTest is false for inFront labels
if (inFront && sprite.material.depthTest == false) {
sprites.push(sprite);
} else if (!inFront && sprite.material.depthTest) {
sprites.push(sprite);
if (!sprite.hidden) {
if (inFront && sprite.material.depthTest == false) {
sprites.push(sprite);
} else if (!inFront && sprite.material.depthTest) {
sprites.push(sprite);
}
}
});

Expand Down Expand Up @@ -340,10 +342,10 @@ export class SpritePlugin {
uniforms.screenPosition,
(sprite.position.x * this.renderer.devicePixelRatio -
halfViewportWidth) /
halfViewportWidth,
halfViewportWidth,
(halfViewportHeight -
sprite.position.y * this.renderer.devicePixelRatio) /
halfViewportHeight,
halfViewportHeight,
Math.max(0, Math.min(1, sprite.position.z))
);
} else {
Expand Down
1 change: 0 additions & 1 deletion src/WebGL/objects/Sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export class Sprite extends Object3D {
_modelViewMatrix: any;
z?: number;
material?: Material;
hidden = false;

constructor(material = new SpriteMaterial() as Material) {
super();
Expand Down

0 comments on commit 4164b52

Please sign in to comment.