Skip to content

Commit

Permalink
Merge pull request #84 from specklesystems/dev
Browse files Browse the repository at this point in the history
Update `main` with changes from `dev`
  • Loading branch information
AlanRynne authored Nov 5, 2024
2 parents 6d5f638 + 8edc01b commit 6e92c85
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let
urlType = urlType,
server = server,
id = streamId,
branch = model[name],
branch = modelId,
commit = versionId,
object = null
]
Expand Down
145 changes: 113 additions & 32 deletions src/powerbi-visual/package-lock.json

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

2 changes: 1 addition & 1 deletion src/powerbi-visual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@heroicons/vue": "^2.0.12",
"@speckle/tailwind-theme": "2.14.7",
"@speckle/ui-components": "2.14.7",
"@speckle/viewer": "^2.18.14",
"@speckle/viewer": "^2.21.0",
"color-interpolate": "^1.0.5",
"core-js": "^3.30.2",
"lodash": "^4.17.21",
Expand Down
16 changes: 8 additions & 8 deletions src/powerbi-visual/src/handlers/viewerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
DefaultViewerParams,
Box3,
SpeckleView,
CameraController
CameraController,
CameraEvent
} from '@speckle/viewer'
import { pickViewableHit, projectToScreen } from '../utils/viewerUtils'
import _ from 'lodash'
Expand Down Expand Up @@ -38,10 +39,9 @@ export default class ViewerHandler {
break
}

this.viewer.getExtension(CameraController).controls.maxPolarAngle = settings.camera
.allowCameraUnder.value
? Math.PI
: Math.PI / 2
var camController = this.viewer.getExtension(CameraController)
var angle = settings.camera.allowCameraUnder.value ? Math.PI : Math.PI / 2
camController.options = { maximumPolarAngle: angle }

// Lighting settings
const newConfig = settings.lighting.getViewerConfiguration()
Expand Down Expand Up @@ -72,7 +72,7 @@ export default class ViewerHandler {
}

public addCameraUpdateEventListener(listener: (ev) => void) {
this.viewer.getExtension(CameraController).controls.addEventListener('update', listener)
this.viewer.getExtension(CameraController).on(CameraEvent.LateFrameUpdate, listener)
}

public constructor(parent: HTMLElement) {
Expand Down Expand Up @@ -213,13 +213,13 @@ export default class ViewerHandler {

public getScreenPosition(worldPosition): { x: number; y: number } {
return projectToScreen(
this.viewer.getExtension(CameraController).controls.camera,
this.viewer.getExtension(CameraController).renderingCamera,
worldPosition
)
}

public dispose() {
this.viewer.getExtension(CameraController).controls.removeAllEventListeners()
this.viewer.getExtension(CameraController).dispose()
this.viewer.dispose()
this.viewer = null
}
Expand Down
3 changes: 2 additions & 1 deletion src/powerbi-visual/src/utils/viewerUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FilteringState } from '@speckle/viewer'
import { OrthographicCamera, PerspectiveCamera } from 'three'

export function projectToScreen(cam, loc) {
export function projectToScreen(cam: OrthographicCamera | PerspectiveCamera, loc) {
cam.updateProjectionMatrix()
const copy = loc.clone()
copy.project(cam)
Expand Down

0 comments on commit 6e92c85

Please sign in to comment.