Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points created by CSS3DSprite cannot be dragged or dropped #697

Open
xiaoxiaofu1 opened this issue Dec 26, 2024 · 0 comments
Open

Points created by CSS3DSprite cannot be dragged or dropped #697

xiaoxiaofu1 opened this issue Dec 26, 2024 · 0 comments

Comments

@xiaoxiaofu1
Copy link

Points created by CSS3DSprite cannot be dragged or dropped
Sprites can be dragged and dropped, so I tried to create a sprite that covers CSS3DSprite, but found that CSS3DSprite always stays at the top layer
Below is some of my code. How can I solve the drag and drop problem

const graph = new ForceGraph3D(container, {
controlType: 'orbit',
extraRenderers: [new CSS3DRenderer()],
})
.nodeThreeObject(createNodeObject(nodeMap))
.onNodeClick(handleNodeClick(graph))
.onNodeDragEnd(handleNodeDragEnd);

const createNodeObject = (nodeMap) => (node) => {
const element = document.createElement('div');

element.className = 'test-element';
element.style.textAlign = 'center';
element.style.position = 'relative';
// Add other DOM, such as images, text, etc., and omit them


const group = new THREE.Group();

// Found that CSS3DSprite cannot be dragged and dropped, while sprite can
const sprite1 = new CSS3DSprite(element)
group.add(sprite1);

// Not covered, you can still see the red sprites behind CSS3DSprite
const spriteMaterial = new THREE.SpriteMaterial({
  color: '#ff0000',
  transparent: true,
  opacity: 1,
}); 
const sprite2 = new THREE.Sprite(spriteMaterial);
group.add(sprite2); 
return group;

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant