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

Annotation for an entity is created with a big offset #953

Open
elyrank opened this issue Nov 8, 2022 · 3 comments
Open

Annotation for an entity is created with a big offset #953

elyrank opened this issue Nov 8, 2022 · 3 comments

Comments

@elyrank
Copy link
Contributor

elyrank commented Nov 8, 2022

Describe the bug
when creating an annotation - by using an entity or pickResult, the annotation is placed with an offset - it is above the selected object.
this becomes much more problematic when zooming out, and the annotation no longer appears related to the actual object.
I saw there is a property- surfaceOffset, but no matter which value I put there I did not see any difference.

tried to create an annotation using code from your examples:

       let i = 1; // Used to create unique Annotation IDs

        viewer.scene.input.on('mouseclicked', (coords) => {
            const pickRecord = viewer.scene.pick({
                canvasPos: coords,
                pickSurface: true, // <<------ This causes picking to find the intersection point on the entity
            });

            if (pickRecord) {
                annotations.createAnnotation({
                    id: `myAnnotationOnClick${i}`,
                    pickRecord,
                    occludable: false, // Optional, default is true
                    markerShown: true, // Optional, default is true
                    labelShown: false, // Optional, default is true
                    values: {
                        // HTML template values
                        title: `My annotation ${i}`,
                    },
                });

                i++;
            }
        });

To Reproduce
Steps to reproduce the behavior:

  1. have a building model
  2. create annotation on an entity
  3. zoom out
  4. See error - annotation no longer appears on the selected entity,

Expected behavior
the annotation should always be exactly on the entity, it should not be "floating in the air" above it and looks like it is not connected to anything

Screenshots
Screen Shot 2022-11-08 at 14 06 08
Screen Shot 2022-11-08 at 14 05 55

Desktop (please complete the following information):

  • OS: [macOS]
  • Browser [chrome]
  • Version [2.3.1]
@mdnmdn
Copy link

mdnmdn commented Dec 12, 2022

Seems the problem is related to the placement of the canvas in the web page.
In all the examples the canvas are fullscreen starting from the upper left corner, the problem arise using multiple containers and relative positioning in the html.

@mdnmdn
Copy link

mdnmdn commented Dec 12, 2022

the solution is here #149

@mdnmdn
Copy link

mdnmdn commented Dec 12, 2022

Duplicate of #149

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

2 participants