-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*Basic mapping functionality *Initial base material list *Sorting and filtering on materials *Viewer updates Co-authored-by: Abhinav Bhardwaj <[email protected]>
- Loading branch information
1 parent
9e82a99
commit a7c5fdc
Showing
33 changed files
with
2,747 additions
and
2,127 deletions.
There are no files selected for viewing
This file contains 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 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 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,76 +1,36 @@ | ||
<template> | ||
<div class="w-5/6 flex flex-col items-center"> | ||
<div class="w-full flex"> | ||
<div | ||
class="transition-all ease-out duration-1000 h-10 rounded-sm bg-green-300 justify-center flex items-center opacity-80 right-0 text-gray-600" | ||
:style="{ width: percentMapped + '%' }" | ||
> | ||
<label v-if="percentMapped > 0" class="text-center"> | ||
{{ percentMapped }}% | ||
</label> | ||
<label v-else class="text-center pl-8"> {{ percentMapped }}% </label> | ||
</div> | ||
<div | ||
class="transition-all ease-out duration-1000 w-1 h-8 m-1 rounded-full bg-white border-transparent border-r opacity-50" | ||
></div> | ||
<div | ||
class="transition-all ease-out duration-1000 top-0 left-0 h-10 rounded-sm bg-red-300 justify-center flex items-center opacity-80" | ||
:style="{ width: 100 - percentMapped + '%' }" | ||
></div> | ||
</div> | ||
<div class="mt-1 flex w-full items-center justify-between text-xs"> | ||
<div class="text-gray-600 left-0">Mapped</div> | ||
<div class="text-gray-600 right-0">Not mapped</div> | ||
</div> | ||
</div> | ||
<div | ||
class="text-center text-bold text-lg" | ||
> | ||
<label | ||
:class="`text-${mappedMaterial.color}0`" | ||
> | ||
{{ mappedMaterial.name }} | ||
</label> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, computed } from 'vue' | ||
import { useProjectStore } from '@/stores/main' | ||
import { defineComponent, computed } from 'vue' | ||
import { useProjectStore } from '@/stores/main' | ||
import { getMappedMaterial } from '@/utils/projectUtils' | ||
import { storeToRefs } from 'pinia' | ||
export default defineComponent({ | ||
name: 'OverviewBar', | ||
components: {}, | ||
setup() { | ||
const projectStore = useProjectStore() | ||
export default defineComponent({ | ||
name: 'MaterialGroupCard', | ||
components: { | ||
}, | ||
setup() { | ||
const { selectedObjects } = storeToRefs(useProjectStore()) | ||
// Get the material mapped to the group and color them accordingly | ||
const mappedMaterial = computed(() => { | ||
return getMappedMaterial(selectedObjects.value) | ||
}) | ||
// Check how many geometry objects has a material mapped to them | ||
const percentMapped = computed(() => { | ||
if (projectStore.selectedGroup == null) { | ||
// If no selection but we have a project get everything | ||
if (projectStore.currProject?.geometry != null) { | ||
const totalObjects = projectStore.currProject.geometry.length | ||
const objectsWithMaterial = | ||
projectStore.currProject.geometry.filter( | ||
(obj) => obj.material !== undefined && obj.material !== null | ||
) | ||
const percentageWithMaterial = | ||
(objectsWithMaterial.length / totalObjects) * 100 | ||
return parseFloat(percentageWithMaterial.toFixed(1)) | ||
} else { | ||
return 0 | ||
} | ||
} else { | ||
// Count the number of objects with and without a material | ||
const totalObjects = projectStore.selectedObjects.length | ||
const objectsWithMaterial = projectStore.selectedObjects.filter( | ||
(obj) => obj.material !== undefined && obj.material !== null | ||
) | ||
const percentageWithMaterial = | ||
(objectsWithMaterial.length / totalObjects) * 100 | ||
// Debug remove for production | ||
const randInt = Math.random() * 100 | ||
return parseFloat(randInt.toFixed(1)) | ||
//return parseFloat(percentageWithMaterial.toFixed(1)) | ||
} | ||
}) | ||
return { | ||
percentMapped | ||
} | ||
} | ||
}) | ||
</script> | ||
return { | ||
mappedMaterial, | ||
} | ||
}, | ||
}) | ||
</script> |
This file contains 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
Oops, something went wrong.