Skip to content
Snippets Groups Projects
Commit 6a5a9945 authored by Trungel's avatar Trungel
Browse files

displaying viewCenter und viewRadius

parent a4b2686f
No related branches found
No related tags found
1 merge request!16Display radius and center
<template>
<div id="parent" class="hexagon" :class="tile.typeId">
<div class="hexTop"></div>
<div class="hexBottom"></div>
<div id="parent" class="hexagon"
:class="[tile.typeId, ((tile.x == store.state.centerX) && (tile.y == store.state.centerY))?'centerTile':'', isViewRadiusBorder()]">
<div class="hexTop" :class="((tile.x == store.state.centerX) && (tile.y == store.state.centerY))?'centerTop':''"></div>
<div class="hexBottom" :class="((tile.x == store.state.centerX) && (tile.y == store.state.centerY))?'centerBottom':''"></div>
<q-btn-dropdown
class="buttonshift without-icon custom-width"
......@@ -33,16 +34,43 @@
</template>
<script>
import {ref} from "vue";
import {inject, ref} from "vue";
export default {
props:{
tile: Object,
typeValue: String
},
setup () {
setup (props) {
var types = ["barren", "clay", "desert", "fish", "forest", "grass", "ice", "iron", "mountain", "salt", "stone", "water", "wheat", "wool"];
const store = inject('store');
const isViewRadiusBorder = function() {
var borders = [];
//leftBorder
if( props.tile.x == (this.store.state.centerX-this.store.state.radiusX) &&
((this.store.state.centerY-this.store.state.radiusY) <= props.tile.y && props.tile.y <= (this.store.state.centerY+this.store.state.radiusY))){
borders.push("viewBorderLeft");
}
if( props.tile.x == (this.store.state.centerX+this.store.state.radiusX) &&
((this.store.state.centerY-this.store.state.radiusY) <= props.tile.y && props.tile.y <= (this.store.state.centerY+this.store.state.radiusY))){
borders.push("viewBorderRight")
}
if( props.tile.y == (this.store.state.centerY+this.store.state.radiusY) &&
((this.store.state.centerX-this.store.state.radiusX) <= props.tile.x && props.tile.x <= (this.store.state.centerX+this.store.state.radiusX))){
borders.push("viewBorderTop")
}
if( props.tile.y == (this.store.state.centerY-this.store.state.radiusY) &&
((this.store.state.centerX-this.store.state.radiusX) <= props.tile.x && props.tile.x <= (this.store.state.centerX+this.store.state.radiusX))){
borders.push("viewBorderBottom")
}
return borders;
}
return {
isViewRadiusBorder,
store,
types,
menuState: ref(false),
label: 'grass',
......@@ -88,6 +116,12 @@ button.without-icon i {
border-right: solid 3px #333333;
}
.centerTile {
z-index: 1002;
border-left: solid 3px red;
border-right: solid 3px red;
}
.hexTop,
.hexBottom {
position: absolute;
......@@ -149,6 +183,52 @@ button.without-icon i {
background: inherit;
}
.viewBorderLeft {
z-index: 1001;
border-left: dashed 3px blue;
}
.viewBorderRight {
z-index: 1001;
border-right: dashed 3px blue;
}
.viewBorderTop {
z-index: 1001;
.hexTop {
border-top: dashed 3px blue;
border-right: dashed 3px blue;
}
}
.viewBorderBottom {
z-index: 1001;
.hexBottom {
border-bottom: dashed 3px blue;
border-left: dashed 3px blue;
}
}
.notShifted{
.viewBorderLeft{
.hexTop{
border-top: dashed 3px blue;
}
.hexBottom{
border-left: dashed 3px blue;
}
}
}
.shifted{
.viewBorderRight{
.hexTop{
border-right: dashed 3px blue;
}
.hexBottom{
border-bottom: dashed 3px blue;
}
}
}
.barren {
background-image: url("../assets/tiles/barren_tile.webp");
button {
......@@ -249,4 +329,14 @@ button.without-icon i {
color: black;
}
}
.centerTop {
border-top: solid 4.2426px red;
border-right: solid 4.2426px red;
}
.centerBottom {
border-bottom: solid 4.2426px red;
border-left: solid 4.2426px red;
}
</style>
......@@ -2,11 +2,10 @@
<span v-if="store.state.lttMap">
<span v-for="(xRow, index) in store.state.lttMap" :key="index">
<div class="row no-wrap"
v-bind:class="{
v-bind:class="[{
firstRow: (index == 0),
moveup: (index !=0),
shifted: (index != 0 && !(index%2))
}"
}, (index != 0 && !(index%2))?'shifted':'notShifted']"
>
<Tile
v-for="(tile, i) in xRow"
......@@ -15,8 +14,6 @@
@update:typeValue="tile.typeId = $event"
v-bind:id="tile.x+'_'+tile.y"
:class="{tileMl: (i!=0)?1:0}"
v-bind:style="{ zIndex: 1000,
}"
v-bind:key="i">
</Tile>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment