-
Notifications
You must be signed in to change notification settings - Fork 0
Play/Pause object motion #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nbbosco
wants to merge
21
commits into
main
Choose a base branch
from
play/pause
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d873e19
add object motion control
nbbosco ea23ffc
readme + changelog
nbbosco 7b6e771
chore: automated build of frontend assets
nbbosco 5ba99c0
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco 0c4df65
Merge branch 'play/pause' of https://github.com/gramaziokohler/compas…
nbbosco 8e6f63b
chore: automated build of frontend assets
nbbosco c774930
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco 934a064
chore: automated build of frontend assets
nbbosco 4d94803
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco d766c95
desactivate if no motion
nbbosco d31df5f
chore: automated build of frontend assets
nbbosco d2a6c87
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco 36c26c2
improve pause toggle
nbbosco 19d89f0
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco 4e61321
chore: automated build of frontend assets
nbbosco 606c17f
Merge branch 'main' of https://github.com/gramaziokohler/compas_three…
nbbosco ac85d00
refactor motion check
nbbosco d9428ad
Merge branch 'play/pause' of https://github.com/gramaziokohler/compas…
nbbosco af6ae39
chore: automated build of frontend assets
nbbosco da447b1
change icon logic
nbbosco 270588f
chore: automated build of frontend assets
nbbosco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
frontend/compas_threejs/src/communications/objectMotion.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { sendData } from "@/communications/communication"; | ||
| import { motionState } from "@/store/store"; | ||
|
|
||
| function notifyBackendObjectMotionPause(paused: boolean): void { | ||
| sendData({ | ||
| dispatch: "object_motion_control", | ||
| paused, | ||
| }); | ||
| } | ||
|
|
||
| export function setObjectMotionPaused(paused: boolean): void { | ||
| if (!motionState.objectMotionAvailable) { | ||
| return; | ||
| } | ||
|
|
||
| if (motionState.objectMotionPaused === paused) { | ||
| return; | ||
| } | ||
|
|
||
| motionState.objectMotionPaused = paused; | ||
| notifyBackendObjectMotionPause(paused); | ||
| } | ||
|
|
||
| export function toggleObjectMotionPaused(): boolean { | ||
| if (!motionState.objectMotionAvailable) { | ||
| return motionState.objectMotionPaused; | ||
| } | ||
|
|
||
| setObjectMotionPaused(!motionState.objectMotionPaused); | ||
| return motionState.objectMotionPaused; | ||
| } | ||
|
|
||
| export function isObjectMotionPaused(): boolean { | ||
| return motionState.objectMotionPaused; | ||
| } | ||
|
|
||
| export function setObjectMotionAvailable(available: boolean): void { | ||
| motionState.objectMotionAvailable = available; | ||
|
|
||
| if (!available) { | ||
| motionState.objectMotionPaused = false; | ||
| } | ||
| } | ||
|
|
||
| export function isObjectMotionAvailable(): boolean { | ||
| return motionState.objectMotionAvailable; | ||
| } | ||
|
|
||
| export function objectMotionManager(data: { [key: string]: any }): void { | ||
| switch (data.type.value) { | ||
| case "availability": | ||
| setObjectMotionAvailable(Boolean(data.enabled.value)); | ||
| break; | ||
| default: | ||
| console.warn("Unknown object motion type:", data.type.value); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
frontend/compas_threejs/src/components/tools/display/ToggleMovementButton.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <template> | ||
| <TooltipProvider :delay-duration="600"> | ||
| <Tooltip> | ||
| <TooltipTrigger> | ||
| <Button | ||
| variant="secondary" | ||
| size="icon" | ||
| :class="{ active }" | ||
| @click="handleClick" | ||
| > | ||
| <Pause class="button-icon" :size="16" /> | ||
| </Button> | ||
| </TooltipTrigger> | ||
| <TooltipContent class="z-1000" side="bottom"> | ||
| <p>Play/Pause motion <Kbd>spacebar</Kbd></p> | ||
| </TooltipContent> | ||
| </Tooltip> | ||
| </TooltipProvider> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { Pause } from "lucide-vue-next"; | ||
| import { toggleObjectMotionPaused } from "@/viewer/toolbar_actions"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Kbd } from "@/components/ui/kbd"; | ||
| import { | ||
| Tooltip, | ||
| TooltipContent, | ||
| TooltipTrigger, | ||
| TooltipProvider, | ||
| } from "@/components/ui/tooltip"; | ||
|
|
||
| const props = defineProps<{ | ||
| active: boolean; | ||
| }>(); | ||
|
|
||
| const emit = defineEmits<{ | ||
| (e: "toggled", paused: boolean): void; | ||
| }>(); | ||
|
|
||
| function handleClick() { | ||
| const paused = toggleObjectMotionPaused(); | ||
| emit("toggled", paused); | ||
| } | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export { default as ToggleMovementButton } from "./ToggleMovementButton.vue"; | ||
| export { default as SaveViewButton } from "./SaveViewButton.vue"; | ||
| export { default as SavedViewsButton } from "./SavedViewsButton.vue"; | ||
| export { default as SaveScreenshotButton } from "./SaveScreenshotButton.vue"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.