\r\n\r\nWe should accept an array too\r\n\u003CTresMesh v-layer:enable=\"[1, 2, 3]\" />\r\n\r\nAnd of course other methods like: disable, test (maybe with a console.log), toggle\r\n\r\nFor more info, check:\r\nhttps://threejs.org/docs/index.html?q=layers#api/en/core/Layers\r\n\n\n### Alternative\n\nAny other alternative is considered\n\n### Additional context\n\nAs we discuss, you can achieve this by using template ref, but sometimes is just too much code, this Issue will could improve the UX\r\n\r\nFollowing the directives pattern (to make our user easier)\n\n### Validations\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/tres/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/tres/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/tres/issues) that reports the same bug to avoid creating a duplicate.",[3059,3062],{"name":3060,"color":3061},"feature","c2e0c6",{"name":3063,"color":3064},"p2-nice-to-have","D4C5F9",543,"v-layer directive","2024-03-30T15:32:13Z","https://github.com/Tresjs/tres/issues/543",0.7649308,{"description":3071,"labels":3072,"number":3077,"owner":3029,"repository":3030,"state":3031,"title":3078,"updated_at":3079,"url":3080,"score":3081},"### Describe the bug\r\n\r\nSome controls have long-standing bugs where changing props causes duplicate events to be added. \r\n\r\nE.g., flipping makeDefault in CameraControls causes duplicate events to be added. This will add 100 duplicate events:\r\n\r\n```\r\nconst makeDefault = shallowRef(true)\r\n// Flip `makeDefault` 100 times, add 100 events! Lol\r\nArray.from({length: 100}).fill(0).forEach(\r\n (_, i) => setTimeout(\r\n () => {\r\n makeDefault.value = !makeDefault.value\r\n }, i * 1000 / 25)\r\n)\r\n\u003C/script>\r\n\r\n\u003Ctemplate>\r\n \u003CTresLeches />\r\n \u003CTresCanvas v-bind=\"gl\">\r\n \u003CTresPerspectiveCamera :position=\"[5, 5, 5]\" />\r\n \u003CCameraControls\r\n v-bind=\"controlsState\"\r\n ref=\"controlsRef\"\r\n :make-default=\"makeDefault\"\r\n @change=\"onChange\"\r\n @start=\"onStart\"\r\n @end=\"onEnd\"\r\n />\r\n \r\n```\r\n \r\n \r\nThat means every time these emits would be expected to fire once, they're fired 100 times:\r\n\r\n```\r\nfunction addEventListeners() {\r\n useEventListener(controlsRef.value as any, 'update', () => {\r\n emit('change', controlsRef.value)\r\n invalidateOnDemand()\r\n })\r\n useEventListener(controlsRef.value as any, 'controlend', () => emit('end', controlsRef.value))\r\n useEventListener(controlsRef.value as any, 'controlstart', () => emit('start', controlsRef.value))\r\n}\r\n```\r\n\r\nThe problem is the anonymous functions:\r\n\r\nNote: If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an addEventListener call, the second function will also be added to the list of event listeners for that target.\r\n\r\nIndeed, anonymous functions are not identical even if defined using the same unchanging source-code called repeatedly, even if in a loop.\r\n\r\nRepeatedly defining the same unnamed function in such cases can be problematic. (See Memory issues, below.)\r\n\r\nhttps://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\r\nMDN Web Docs\r\n[EventTarget: addEventListener() method - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)\r\nThe addEventListener() method of the EventTarget interface\r\nsets up a function that will be called whenever the specified event is delivered to the target.\r\n\r\n### Reproduction\r\n\r\nN/A\r\n\r\n### Steps to reproduce\r\n\r\n_No response_\r\n\r\n### System Info\r\n\r\n_No response_\r\n\r\n### Used Package Manager\r\n\r\nnpm\r\n\r\n### Code of Conduct\r\n\r\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/cientos/blob/main/CODE_OF_CONDUCT.md)\r\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/cientos/blob/main/CONTRIBUTING.md).\r\n- [X] Read the [docs](https://cientos.tresjs.org/guide).\r\n- [X] Check that there isn't [already an issue](https://github.com/Tresjs/cientos/issues) that reports the same bug to avoid creating a duplicate.\r\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[3073,3074],{"name":3020,"color":3021},{"name":3075,"color":3076},"p3-minor-bug","F28C37",457,"useEventListener bug in controls","2024-07-24T06:42:25Z","https://github.com/Tresjs/cientos/issues/457",0.7687696,{"description":3083,"labels":3084,"number":3090,"owner":3029,"repository":3091,"state":3031,"title":3092,"updated_at":3093,"url":3094,"score":3095},"### Description\n\nAfter the initial, what about creating abstraction/component like in cientos but that only works with physics\n\n### Suggested solution\n\nLike Attractor in r3f\n\n### Alternative\n\n_No response_\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/rapier/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/rapier/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://rapier.tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/rapier/issues) that reports the same bug to avoid creating a duplicate.",[3085,3086,3089],{"name":3060,"color":3061},{"name":3087,"color":3088},"investigation","D03599",{"name":3063,"color":3064},135,"rapier","Cloth simmulator","2024-10-04T10:54:33Z","https://github.com/Tresjs/rapier/issues/135",0.77042896,{"description":3097,"labels":3098,"number":3101,"owner":3029,"repository":3030,"state":3031,"title":3102,"updated_at":3103,"url":3104,"score":3105},"### Describe the bug\n\n`useProgress` uses threejs `DefaultLoadingManager` under the hood. Progress restarts with concurrent resources\n\n### Reproduction\n\nhttps://lab.tresjs.org/experiments/potions-classroom\n\n### Steps to reproduce\n\n_No response_\n\n### System Info\n\n_No response_\n\n### Used Package Manager\n\npnpm\n\n### Code of Conduct\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/cientos/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/cientos/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://cientos.tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/Tresjs/cientos/issues) that reports the same bug to avoid creating a duplicate.\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[3099,3100],{"name":3020,"color":3021},{"name":3075,"color":3076},575,"useProgress re-starts when other resources start loading","2025-01-02T14:42:43Z","https://github.com/Tresjs/cientos/issues/575",0.77384305,{"description":3107,"labels":3108,"number":3110,"owner":3029,"repository":3051,"state":3111,"title":3112,"updated_at":3113,"url":3114,"score":3115},"**Describe the bug**\r\n\r\nWhen using `useRenderLoop`, immediately calling `pause` doesn't cause the animation to be initially paused:\r\n\r\n```js\r\nconst { onLoop, pause } = useRenderLoop();\r\nonLoop(() => {\r\n if (boxMeshRef.value) {\r\n boxMeshRef.value.rotation.y += 0.01;\r\n }\r\n});\r\npause();\r\n```\r\n\r\nI'd expect the above code to result in an animation that doesn't run until `play()` is ran, but instead, it's as if `pause()` was never called.\r\n\r\nThe following also don't work:\r\n\r\n- Calling `pause()` in a watcher on `boxMeshRef.value`\r\n- Calling `pause()` in any watcher with `immediate: true`\r\n- Calling `pause()` in `onMounted()`\r\n\r\nThe only workaround I've found is to call `pause()` in a `nextTick()` callback.\r\n\r\n**Reproduction**\r\n\r\nhttps://stackblitz.com/edit/tresjs-basic-q53da8?file=src/components/TheExperience.vue\r\n\r\n**System Info**\r\n\r\n```\r\n System:\r\n OS: macOS 13.2.1\r\n CPU: (10) arm64 Apple M2 Pro\r\n Memory: 878.45 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node\r\n Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn\r\n npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm\r\n Browsers:\r\n Chrome: 112.0.5615.137\r\n Safari: 16.3\r\n npmPackages:\r\n @tresjs/cientos: ^2.0.0-rc.1 => 2.0.0-rc.1\r\n @tresjs/core: ^2.0.0-rc.2 => 2.0.0-rc.2\r\n vite: ^4.0.0 => 4.0.1\r\n```\r\n",[3109],{"name":3087,"color":3088},251,"closed","Calling `pause` immediately after `onLoop` doesn't do anything","2024-05-30T06:46:00Z","https://github.com/Tresjs/tres/issues/251",0.4631476,{"description":3117,"labels":3118,"number":3119,"owner":3029,"repository":3051,"state":3111,"title":3120,"updated_at":3121,"url":3122,"score":3123},"### Describe the bug\n\nWhen running `pnpm run docs:dev` and visiting `http://localhost:5173/guide/` the terminal displays the following warning:\r\n\r\n```\r\n5:05:06 PM [vitepress] hmr update /guide/index.md\r\nAssets in public directory cannot be imported from JavaScript.\r\nIf you intend to import that asset, put the file in the src directory, and use /src/playground.png instead of /public/playground.png.\r\nIf you intend to use the URL of that asset, use /playground.png?url.\r\nFiles in the public directory are served at the root path.\r\nInstead of /public/playground.png, use /playground.png.\r\n```\n\n### Reproduction\n\nNone\n\n### Steps to reproduce\n\n* In the terminal, run `pnpm run docs:dev`\r\n* In the browser, visit `http://localhost:5173/guide/`\r\n* In the terminal, see the warning\n\n### System Info\n\n```shell\nSystem:\r\n OS: macOS 14.0\r\n CPU: (8) arm64 Apple M1\r\n Memory: 136.88 MB / 8.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 20.8.1 - /opt/homebrew/bin/node\r\n npm: 10.1.0 - /opt/homebrew/bin/npm\r\n pnpm: 8.6.5 - /opt/homebrew/bin/pnpm\r\n Browsers:\r\n Chrome: 120.0.6099.234\r\n Safari: 17.0\r\n npmPackages:\r\n @tresjs/cientos: 3.7.0 => 3.7.0 \r\n @tresjs/eslint-config-vue: ^0.2.1 => 0.2.1 \r\n vite: ^5.0.10 => 5.0.10\n```\n\n\n### Used Package Manager\n\npnpm\n\n### Code of Conduct\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/tres/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/tres/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/tres/issues) that reports the same bug to avoid creating a duplicate.\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[],518,"docs(bug): vitepress console warning, playground image","2024-01-22T08:31:09Z","https://github.com/Tresjs/tres/issues/518",0.73469096,{"description":3125,"labels":3126,"number":3130,"owner":3029,"repository":3131,"state":3111,"title":3132,"updated_at":3133,"url":3134,"score":3135},"**Is your feature request related to a problem? Please describe.**\r\nThe effects from [three.js itself](https://threejs.org/examples/?q=postprocessing) should be available in this package.\r\n\r\n**Describe the solution you'd like**\r\nSimilar to the existing effects. A submodule would be handy.\r\n",[3127],{"name":3128,"color":3129},"enhancement","a2eeef",113,"post-processing","Native three.js effects","2024-09-26T07:21:06Z","https://github.com/Tresjs/post-processing/issues/113",0.75768596,["Reactive",3137],{},["Set"],["ShallowReactive",3140],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fA1YScVzuQlUUok_Hz4t1azROmRwcKUhdCHP3H1Xjr-A":-1},"/Tresjs/cientos/251"]