最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Autodesk viewer Zoom handler - Stack Overflow

programmeradmin2浏览0评论

I face an issue with zoom handler. Sometimes when i start viewer zoom handler zoom to the top of canvas, not to cursor position. After browser window resize or page refresh it fixes. It happens not often, but i don't understand the reason of this behavior and how to prevent this issue.

I try to reapply NOP_VIEWER.toolController.mousewheel on div container with addEventListener on parent container which size is the same as viewer-adsk-container, but it changes nothing.

I don't understand which part of code i should share in this case, please advise if needed.

Also i use viewer v7.105.

Thank you in advance.

UPD:

When this issue occurs - click is not working too. I cannot select any item in view. I work with viewer 1+ year and never met this issues before.

I face an issue with zoom handler. Sometimes when i start viewer zoom handler zoom to the top of canvas, not to cursor position. After browser window resize or page refresh it fixes. It happens not often, but i don't understand the reason of this behavior and how to prevent this issue.

I try to reapply NOP_VIEWER.toolController.mousewheel on div container with addEventListener on parent container which size is the same as viewer-adsk-container, but it changes nothing.

I don't understand which part of code i should share in this case, please advise if needed.

Also i use viewer v7.105.

Thank you in advance.

UPD:

When this issue occurs - click is not working too. I cannot select any item in view. I work with viewer 1+ year and never met this issues before.

Share Improve this question edited Mar 11 at 12:13 Evhenii asked Mar 11 at 11:15 EvheniiEvhenii 636 bronze badges 4
  • UPD: I figured out that in case issue occurs 'canvasY' is lower than 0, for some reason in canvasX=0 and canvasY=0, event fires with canvasX=0 and canvasY=-containerHeight. I don't understand why it is happening. I start viewer useEffect and use viewer.finish() in return callback in the same useEffect. Maybe i incorrect clear it, but this issue never happens few weeks ago. And i don't change init and clear code for year. – Evhenii Commented Mar 12 at 9:19
  • Are you customizing the zoom functionality? Could you add the relevant code e.g. to this very basic sample to show what you're doing? aps.autodesk/blog/publicly-share-models-customized-viewer – Adam Nagy Commented Mar 25 at 13:40
  • @AdamNagy Thank you for reacting to this issues. I believe I found the issue cause. I post it as response to this topic. Maybe you have some comments regarding this response. – Evhenii Commented Mar 25 at 15:34
  • Not much I can add. I guess it depends on the CSS settings if/how that element was interfering with the Viewer. If you need the <IdleLoader /> you'd have to investigate how to use it without it causing problems. – Adam Nagy Commented Mar 26 at 11:36
Add a comment  | 

1 Answer 1

Reset to default 0

It seems that the issue was in mounting spiner container as neighbour of viewer container when model is not loaded. I remove that spiner and issue is not fires again.

I assume that this spinner shifted viewer container out of viewport and all handlers inside the viewer are trying to use those negative canvasY values from container which was out of viewport.

Below you can see my return from React component with viewer. I removed {!modelLoaded && <IdleLoader />} and after that i cannot reproduce this issue.

  return (
    <>
      {!modelLoaded && <IdleLoader />}
      <div ref={container}></div>
    </>
  );
发布评论

评论列表(0)

  1. 暂无评论