Improved Attribute damage viewer
This commit is contained in:
@@ -10,7 +10,11 @@
|
|||||||
<div
|
<div
|
||||||
class="text-no-wrap text-truncate"
|
class="text-no-wrap text-truncate"
|
||||||
>
|
>
|
||||||
{{ model.amountResult }} {{ model.stat }} damage
|
<span v-if="model.amountResult < 0">+</span>
|
||||||
|
{{ absoluteAmount }} {{ model.stat }}
|
||||||
|
<span v-if="typeof absoluteAmount === 'string' || absoluteAmount >= 0">
|
||||||
|
damage
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -20,5 +24,14 @@ import treeNodeViewMixin from '/imports/ui/properties/treeNodeViews/treeNodeView
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [treeNodeViewMixin],
|
mixins: [treeNodeViewMixin],
|
||||||
|
computed: {
|
||||||
|
absoluteAmount(){
|
||||||
|
if (typeof this.model.amountResult === 'number'){
|
||||||
|
return Math.abs(this.model.amountResult);
|
||||||
|
} else {
|
||||||
|
return this.model.amountResult;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,14 +1,76 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div class="adjustment-viewer layout row align-center">
|
<v-list-tile class="effect-viewer">
|
||||||
{{ model.amountResult }} {{ model.stat }} damage
|
<v-list-tile-avatar>
|
||||||
</div>
|
<v-tooltip bottom>
|
||||||
|
<template
|
||||||
|
v-if="effectIcon !== 'remove'"
|
||||||
|
#activator="{ on }"
|
||||||
|
>
|
||||||
|
<v-icon
|
||||||
|
class="mx-2"
|
||||||
|
style="cursor: default;"
|
||||||
|
v-on="on"
|
||||||
|
>
|
||||||
|
{{ effectIcon }}
|
||||||
|
</v-icon>
|
||||||
|
</template>
|
||||||
|
<span>{{ tooltip }}</span>
|
||||||
|
</v-tooltip>
|
||||||
|
</v-list-tile-avatar>
|
||||||
|
<v-list-tile-action class="headline">
|
||||||
|
{{ displayedValue }}
|
||||||
|
</v-list-tile-action>
|
||||||
|
<v-list-tile-content>
|
||||||
|
<v-list-tile-title>
|
||||||
|
<code>{{ model.stat }}</code>
|
||||||
|
<template v-if="effectIcon === 'remove'">
|
||||||
|
damage
|
||||||
|
</template>
|
||||||
|
</v-list-tile-title>
|
||||||
|
</v-list-tile-content>
|
||||||
|
</v-list-tile>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyViewerMixin.js';
|
import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyViewerMixin.js';
|
||||||
|
import getEffectIcon from '/imports/ui/utility/getEffectIcon.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [propertyViewerMixin],
|
mixins: [propertyViewerMixin],
|
||||||
|
computed: {
|
||||||
|
effectIcon(){
|
||||||
|
let effectOp = this.model.operation === 'increment' ? 'add' : 'base';
|
||||||
|
let value = this.model.amountResult;
|
||||||
|
if (typeof value === 'string'){
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
return getEffectIcon(effectOp, -value);
|
||||||
|
},
|
||||||
|
displayedValue(){
|
||||||
|
if (
|
||||||
|
typeof this.model.amountResult === 'number' &&
|
||||||
|
this.model.operation !== 'set'
|
||||||
|
){
|
||||||
|
return Math.abs(this.model.amountResult);
|
||||||
|
} else {
|
||||||
|
return this.model.amountResult;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tooltip(){
|
||||||
|
if (this.model.operation === 'increment'){
|
||||||
|
if (
|
||||||
|
typeof this.model.amountResult === 'string' ||
|
||||||
|
this.model.amountResult >= 0
|
||||||
|
){
|
||||||
|
return 'Minus';
|
||||||
|
} else {
|
||||||
|
return 'Add'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 'Set'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user