Skip to content

Commit

Permalink
fix: 179 tweakpane plugin essentials (#180)
Browse files Browse the repository at this point in the history
* fix: remove tweakpane essentials import

* chore: release v3.2.0-next.0

* docs: add deprecation warnings

* chore: correct useLogger import path

* chore: remove fpsgraph code

* chore: remove plugin essentials
  • Loading branch information
alvarosabu authored Aug 25, 2023
1 parent 5f60864 commit 67b8d57
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 26 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@


## [3.2.0-next.0](https://github.com/Tresjs/cientos/compare/3.1.0...3.2.0-next.0) (2023-08-23)


### Features

* 107 use video texture ([#167](https://github.com/Tresjs/cientos/issues/167)) ([f0f1f9b](https://github.com/Tresjs/cientos/commit/f0f1f9bc6107c2d040195ca76f647ef6dcbeb2d3))


### Bug Fixes

* remove tweakpane essentials import ([eeed334](https://github.com/Tresjs/cientos/commit/eeed334398374089d17b3ebf34bfc7b5f963372b))

## [3.1.0](https://github.com/Tresjs/cientos/compare/3.0.1...3.1.0) (2023-08-17)


Expand Down
1 change: 0 additions & 1 deletion docs/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ declare module 'vue' {
LoveVueThreeJS: typeof import('./.vitepress/theme/components/LoveVueThreeJS.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
WobbleMaterial: typeof import('./.vitepress/theme/components/WobbleMaterial.vue')['default']
WobbleMaterialDemo: typeof import('./.vitepress/theme/components/WobbleMaterialDemo.vue')['default']
}
}
6 changes: 6 additions & 0 deletions docs/guide/misc/use-tweakpane.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

[TweakPane](https://cocopon.github.io/tweakpane/) is a JavaScript library for creating a user interface for tweaking values of JavaScript variables. It's a great tool for fine-tuning parameters and monitoring value changes on your three.js applications.

::: warning

useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to [`@tresjs/leches` package](https://github.com/Tresjs/leches) or [v-tweakpane](https://github.com/vinayakkulkarni/v-tweakpane) instead.

:::

::: code-group

```bash [pnpm]
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tresjs/cientos",
"description": "Collection of useful helpers and fully functional, ready-made abstractions for Tres",
"version": "3.1.0",
"version": "3.2.0-next.0",
"type": "module",
"packageManager": "pnpm@8.4.0",
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
Expand Down Expand Up @@ -53,7 +53,6 @@
"@alvarosabu/prettier-config": "^1.3.0",
"@release-it/conventional-changelog": "^7.0.0",
"@tweakpane/core": "^1.1.9",
"@tweakpane/plugin-essentials": "^0.1.8",
"@types/node": "^20.5.4",
"@types/three": "^0.155.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
Expand Down
11 changes: 0 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions src/core/misc/useTweakPane/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { onUnmounted, onMounted } from 'vue'
import { Pane } from 'tweakpane'
import * as EssentialsPlugin from '@tweakpane/plugin-essentials'
import { useRenderLoop } from '@tresjs/core'
import { useLogger } from '../../../composables/useLogger'

type TweakPane = Pane & { addBlade(blade: any): void, addInput(blade: any): void }
let pane: TweakPane
let fpsGraph: any

export /**
* Creates a TweakPane instance and returns it.
Expand All @@ -22,14 +21,12 @@ export /**
pane.element.style.top = '1rem'
pane.element.style.right = '1rem'
pane.element.style.zIndex = '9999'
pane.registerPlugin(EssentialsPlugin)

fpsGraph = pane.addBlade({
view: 'fpsgraph',
label: 'fpsgraph',
})
}

const { logWarning } = useLogger()

logWarning('useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to @tresjs/leches package https://github.com/Tresjs/leches or v-tweakpane https://github.com/vinayakkulkarni/v-tweakpane instead.')

/**
* Disposes the TweakPane instance.
*
Expand All @@ -41,14 +38,12 @@ export /**
}

onMounted(() => {
const { onBeforeLoop, onAfterLoop, resume } = useRenderLoop()
const { resume } = useRenderLoop()
resume()
onBeforeLoop(() => fpsGraph.begin())
onAfterLoop(() => fpsGraph.end())
})
onUnmounted(() => {
disposeTweakPane()
})

return { pane, fpsGraph, disposeTweakPane }
return { pane, disposeTweakPane }
}
4 changes: 4 additions & 0 deletions stats.html

Large diffs are not rendered by default.

0 comments on commit 67b8d57

Please sign in to comment.