Blame view

天文台pc/tianwentai-ui/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs 1.01 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  import { createProjectionNode } from './create-projection-node.mjs';
  import { DocumentProjectionNode } from './DocumentProjectionNode.mjs';
  
  const rootProjectionNode = {
      current: undefined,
  };
  const HTMLProjectionNode = createProjectionNode({
      measureScroll: (instance) => ({
          x: instance.scrollLeft,
          y: instance.scrollTop,
      }),
      defaultParent: () => {
          if (!rootProjectionNode.current) {
              const documentNode = new DocumentProjectionNode({});
              documentNode.mount(window);
              documentNode.setOptions({ layoutScroll: true });
              rootProjectionNode.current = documentNode;
          }
          return rootProjectionNode.current;
      },
      resetTransform: (instance, value) => {
          instance.style.transform = value !== undefined ? value : "none";
      },
      checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"),
  });
  
  export { HTMLProjectionNode, rootProjectionNode };
  //# sourceMappingURL=HTMLProjectionNode.mjs.map