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
Showing
9 changed files
with
238 additions
and
67 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Vue from "vue"; | ||
import Component from "vue-class-component"; | ||
import * as Tea from "../Tea"; | ||
|
||
@Component({ | ||
template: ` | ||
<div | ||
class="Inspector"> | ||
<div>{{ name }}</div> | ||
<Vector3 text="Position" :value="position"></Vector3> | ||
<Vector3 text="Rotation" :value="rotation"></Vector3> | ||
<Vector3 text="Scale" :value="scale"></Vector3> | ||
</div> | ||
`, | ||
data: () => { return { | ||
name: "", | ||
position: null, | ||
rotation: null, | ||
scale: null | ||
}} | ||
}) | ||
export class Inspector extends Vue { | ||
name: string; | ||
position: Tea.Vector3; | ||
rotation: Tea.Vector3; | ||
scale: Tea.Vector3; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Vue from "vue"; | ||
import Component from "vue-class-component"; | ||
import * as Tea from "../Tea"; | ||
|
||
@Component({ | ||
template: ` | ||
<div class="Vector3"> | ||
<template v-if="value"> | ||
<div class="title">{{ text }}</div> | ||
<div class="value"> | ||
X <input type="text" size="1" :value="x"></input> | ||
Y <input type="text" size="1" :value="y"></input> | ||
Z <input type="text" size="1" :value="z"></input> | ||
</div> | ||
</template> | ||
</div> | ||
`, | ||
props: { | ||
text: String, | ||
value: Array | ||
}, | ||
data: () => { | ||
return { | ||
//text: "", | ||
//value: null | ||
} | ||
} | ||
}) | ||
export class Vector3 extends Vue { | ||
text: string; | ||
value: Tea.Vector3; | ||
|
||
get x(): string { | ||
if (this.value == null) { | ||
return ""; | ||
} | ||
return this.toText(this.value[0]); | ||
} | ||
|
||
get y(): string { | ||
if (this.value == null) { | ||
return ""; | ||
} | ||
return this.toText(this.value[1]); | ||
} | ||
|
||
get z(): string { | ||
if (this.value == null) { | ||
return ""; | ||
} | ||
return this.toText(this.value[2]); | ||
} | ||
|
||
protected toText(value: number): string { | ||
var text = value.toFixed(5).replace(/\.0+$/, ""); | ||
if (text.indexOf(".") < 0) { | ||
if (text == "-0") { | ||
return "0"; | ||
} | ||
return text; | ||
} | ||
text = text.replace(/0+$/, ""); | ||
return text; | ||
} | ||
} |
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,28 @@ | ||
#{$parent} { | ||
div.Vector3 { | ||
position: relative; | ||
width: 100%; | ||
line-height: 1.5; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
|
||
.title { | ||
display: inline-block; | ||
width: 30%; | ||
} | ||
|
||
.value { | ||
display: inline-block; | ||
position: absolute; | ||
right: 0; | ||
width: 70%; | ||
text-align: right; | ||
} | ||
|
||
input { | ||
min-width: 3.5em; | ||
width: auto; | ||
height: 1em; | ||
} | ||
} | ||
} |
Oops, something went wrong.