diff --git a/src/components/Tile.vue b/src/components/Tile.vue index 8fa5c8830d066ec4b2dd8082c1fffc6682158b0c..6ded5516587506e004b02e9505de62af68106f01 100644 --- a/src/components/Tile.vue +++ b/src/components/Tile.vue @@ -1,8 +1,9 @@ <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> diff --git a/src/pages/Index.vue b/src/pages/Index.vue index a2f1199f0b2bcf3d290f1c66dabd8550e4840791..2249a63635230fa7d90b4abd8da64bfe359f3cbb 100644 --- a/src/pages/Index.vue +++ b/src/pages/Index.vue @@ -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>