Skip to content

Commit eacfa4a

Browse files
committed
update OffscreenCanvas
1 parent e021855 commit eacfa4a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

22 Three.js优化之OffscreenCanvas与WebWorker.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,32 @@ if ( state !== STATE.NONE ) {
513513
514514
515515
516+
**除了模拟出 DOM 元素的各种事件之外,还需要模拟出其他一些内容:**
517+
518+
> 你可以先想一下常见 DOM 元素还有哪些常用的属性或方法?
519+
520+
1. event.preventDefault、event.stopPropagation:事件冒泡相关设置
521+
2. focus():设置 DOM 元素为当前焦点
522+
3. clientWidth、clientHeight:对象原始宽高
523+
4. getBoundingClientRect():获取元素显示大小、相对浏览器视窗的位置
524+
525+
526+
516527
思路理清之后,剩下的就容易了。
517528
518529
519530
531+
有 2 个思路途径:
532+
533+
1. 使用 Three.js 提供的 EventDispatcher
534+
535+
```
536+
import { EventDispatcher } from 'three'
537+
```
538+
539+
2. 使用 原生 JS 提供的 EventTarget
540+
541+
542+
543+
额~ 因为最近接了一个设计的活,本文先暂停更新几天。
544+

0 commit comments

Comments
 (0)