Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #280 from vimaec/sroberge/0_3_11
Browse files Browse the repository at this point in the history
Sroberge/0 3 11
  • Loading branch information
vim-sroberge authored Aug 30, 2024
2 parents f26a7f4 + c8442b9 commit 47f3233
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 71 deletions.
104 changes: 41 additions & 63 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vim-webgl-component",
"version": "0.3.11-dev.0",
"version": "0.3.11",
"description": "A demonstration app built on top of the vim-webgl-viewer",
"files": [
"dist"
Expand Down Expand Up @@ -30,7 +30,6 @@
"devDependencies": {
"@types/react": "^17.0.39",
"@types/react-dom": "^18.0.9",
"@types/three": "^0.146.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"autoprefixer": "10.4.5",
"eslint": "^8.23.1",
Expand Down Expand Up @@ -62,7 +61,7 @@
"react-tooltip": "^4.2.21",
"stats-js": "^1.0.1",
"tailwindcss-scoped-preflight": "^3.2.8",
"vim-webgl-viewer": "2.0.5-dev.3"
"vim-webgl-viewer": "2.0.5"
},
"peerDependencies": {
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/controlbar/controlBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ export function ControlBar (props: {
},
{
id: elementIds.buttonSectionBoxClip,
tip: section.clip ? 'Clip Section Box' : 'Ignore Section Box',
tip: section.clip ? 'Ignore Section Box' : 'Clip Section Box',
action: () => section.toggleClip(),
icon: section.clip ? Icons.sectionBoxClip : Icons.sectionBoxNoClip,
icon: section.clip ? Icons.sectionBoxIgnore : Icons.sectionBoxClip,
style: buttonBlueStyle
},
{
Expand Down
8 changes: 7 additions & 1 deletion src/controlbar/sectionBoxState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { useEffect, useState, useRef } from 'react'
import ReactTooltip from 'react-tooltip'
import * as VIM from 'vim-webgl-viewer/'

Expand All @@ -10,6 +10,7 @@ export type SectionState = {
export function getSectionBoxState (viewer: VIM.Viewer) {
const sectionGizmo = viewer.gizmos.section

const first = useRef(true)
const [section, setSection] = useState<SectionState>({
clip: sectionGizmo.clip,
active: sectionGizmo.visible && sectionGizmo.interactive
Expand Down Expand Up @@ -42,6 +43,11 @@ export function getSectionBoxState (viewer: VIM.Viewer) {

sectionGizmo.interactive = next
sectionGizmo.visible = next

if (next && first.current) {
sectionGizmo.fitBox(viewer.renderer.getBoundingBox())
first.current = false
}
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ export function sectionBoxClip ({ height, width, fill, className }: IconOptions)
)
}

export function sectionBoxNoClip ({ height, width, fill, className }: IconOptions) {
export function sectionBoxIgnore ({ height, width, fill, className }: IconOptions) {
return (
<svg className={className} height={height} width={width} viewBox="0 0 256 256">
<path fill="none" d="M0 0h256v256H0z" />
Expand Down
2 changes: 1 addition & 1 deletion src/settings/settingsState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function useSettings (
const next = { ...settings } // Shallow copy
updater(next)
validateSettings(next)
saveSettingsToLocal(settings)
saveSettingsToLocal(next)
setSettings(next)
onUpdate.current?.(next)
}
Expand Down

0 comments on commit 47f3233

Please sign in to comment.