-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65163c8
commit 0155134
Showing
7 changed files
with
163 additions
and
37 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,33 +1,41 @@ | ||
<template> | ||
<div class="f-component f-component-2d"> | ||
<FComponentIcon :icon-name="iconName" /> | ||
<h4 class="f-component-id"> | ||
{{ component.constructor.name }} ({{ component.__ID__ }}) | ||
</h4> | ||
<div class="f-component-property"> | ||
<div class="f-component-property-group"> | ||
<FComponentHeader | ||
:component="component" | ||
:show-details="showDetails" | ||
@click="showDetails = !showDetails" | ||
/> | ||
<div class="f-component-properties" :class="{ 'f-component-properties--hidden': !showDetails }"> | ||
<div class="f-component-property"> | ||
<p>Position</p> | ||
<p>x : {{ component.position.x }}</p> | ||
<p>y : {{ component.position.y }}</p> | ||
<div class="f-component-property-group"> | ||
<p>x : {{ cropValue(component.position.x) }}</p> | ||
<p>y : {{ cropValue(component.position.y) }}</p> | ||
</div> | ||
</div> | ||
<div class="f-component-property"> | ||
<p>Rotation</p> | ||
<div class="f-component-property-group"> | ||
<p>r : {{ cropValue(component.rotation) }}</p> | ||
</div> | ||
</div> | ||
<p>r : {{ component.rotation }}</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PropType } from 'vue' | ||
import { defineProps } from 'vue' | ||
import { defineProps, ref } from 'vue' | ||
import type { FComponent2d } from '@fibbojs/2d' | ||
import FComponentIcon from '../icons/FComponentIcon.vue' | ||
import { useComponentIcon } from '../../composables/useComponentIcon' | ||
import FComponentHeader from '../common/FComponentHeader.vue' | ||
import { cropValue } from '../../utils/cropValue' | ||
const props = defineProps({ | ||
defineProps({ | ||
component: { | ||
type: Object as PropType<FComponent2d>, | ||
required: true, | ||
}, | ||
}) | ||
const iconName = useComponentIcon(props.component) | ||
const showDetails = ref(false) | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,44 @@ | ||
<template> | ||
<div class="f-component f-component-3d"> | ||
<FComponentIcon :icon-name="iconName" /> | ||
<h4 class="f-component-id"> | ||
{{ component.constructor.name }} ({{ component.__ID__ }}) | ||
</h4> | ||
<div class="f-component-property"> | ||
<div class="f-component-property-group"> | ||
<FComponentHeader | ||
:component="component" | ||
:show-details="showDetails" | ||
@click="showDetails = !showDetails" | ||
/> | ||
<div class="f-component-properties" :class="{ 'f-component-properties--hidden': !showDetails }"> | ||
<div class="f-component-property"> | ||
<p>Position</p> | ||
<p>x : {{ component.position.x }}</p> | ||
<p>y : {{ component.position.y }}</p> | ||
<p>z : {{ component.position.z }}</p> | ||
<div class="f-component-property-group"> | ||
<p>x : {{ cropValue(component.position.x) }}</p> | ||
<p>y : {{ cropValue(component.position.y) }}</p> | ||
<p>z : {{ cropValue(component.position.z) }}</p> | ||
</div> | ||
</div> | ||
<div class="f-component-property-group"> | ||
<div class="f-component-property"> | ||
<p>Rotation</p> | ||
<p>x : {{ component.rotation.x }}</p> | ||
<p>y : {{ component.rotation.y }}</p> | ||
<p>z : {{ component.rotation.z }}</p> | ||
<div class="f-component-property-group"> | ||
<p>x : {{ cropValue(component.rotation.x) }}</p> | ||
<p>y : {{ cropValue(component.rotation.y) }}</p> | ||
<p>z : {{ cropValue(component.rotation.z) }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PropType } from 'vue' | ||
import { defineProps } from 'vue' | ||
import { defineProps, ref } from 'vue' | ||
import type { FComponent3d } from '@fibbojs/3d' | ||
import FComponentIcon from '../icons/FComponentIcon.vue' | ||
import { useComponentIcon } from '../../composables/useComponentIcon' | ||
import FComponentHeader from '../common/FComponentHeader.vue' | ||
import { cropValue } from '../../utils/cropValue' | ||
const props = defineProps({ | ||
defineProps({ | ||
component: { | ||
type: Object as PropType<FComponent3d>, | ||
required: true, | ||
}, | ||
}) | ||
const iconName = useComponentIcon(props.component) | ||
const showDetails = ref(false) | ||
</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
29 changes: 29 additions & 0 deletions
29
packages/devtools/src/components/common/FComponentHeader.vue
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<div class="f-component-header" :class="{ 'f-component-header--open': showDetails }"> | ||
<div class="f-component-header-arrow"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="0.5em" height="1em" viewBox="0 0 12 24"><path fill="currentColor" fill-rule="evenodd" d="M10.157 12.711L4.5 18.368l-1.414-1.414l4.95-4.95l-4.95-4.95L4.5 5.64l5.657 5.657a1 1 0 0 1 0 1.414" /></svg> | ||
</div> | ||
<FComponentIcon :icon-name="iconName" /> | ||
<p class="f-component-name"> | ||
{{ component.constructor.name }} <span class="f-component-id">({{ component.__ID__ }})</span> | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PropType } from 'vue' | ||
import { defineProps } from 'vue' | ||
import type { FComponent } from '@fibbojs/core' | ||
import FComponentIcon from '../icons/FComponentIcon.vue' | ||
import { useComponentIcon } from '../../composables/useComponentIcon' | ||
const props = defineProps({ | ||
component: { | ||
type: Object as PropType<FComponent>, | ||
required: true, | ||
}, | ||
showDetails: Boolean, | ||
}) | ||
const iconName = useComponentIcon(props.component) | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Crop a given value to a certain length. | ||
* Always convert to string and return as string. | ||
*/ | ||
export function cropValue(value: any, length: number = 5): string { | ||
const str = String(value) | ||
return str.length > length ? str.slice(0, length) : str | ||
} |