Skip to content
Snippets Groups Projects

Display radius and center

Merged Griefed requested to merge github/fork/Trungel/datastructures into master
3 files
+ 123
15
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 115
5
<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,isViewRadiusBorder(), ((tile.x == store.state.centerX) && (tile.y == store.state.centerY))?'centerTile':'']">
<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+1) &&
((this.store.state.centerY-this.store.state.radiusY+1) <= props.tile.y && props.tile.y <= (this.store.state.centerY+this.store.state.radiusY-1))){
borders.push("viewBorderLeft");
}
if( props.tile.x == (this.store.state.centerX+this.store.state.radiusX-1) &&
((this.store.state.centerY-this.store.state.radiusY+1) <= props.tile.y && props.tile.y <= (this.store.state.centerY+this.store.state.radiusY-1))){
borders.push("viewBorderRight")
}
if( props.tile.y == (this.store.state.centerY+this.store.state.radiusY-1) &&
((this.store.state.centerX-this.store.state.radiusX+1) <= props.tile.x && props.tile.x <= (this.store.state.centerX+this.store.state.radiusX-1))){
borders.push("viewBorderTop")
}
if( props.tile.y == (this.store.state.centerY-this.store.state.radiusY+1) &&
((this.store.state.centerX-this.store.state.radiusX+1) <= props.tile.x && props.tile.x <= (this.store.state.centerX+this.store.state.radiusX-1))){
borders.push("viewBorderBottom")
}
return borders;
}
return {
isViewRadiusBorder,
store,
types,
menuState: ref(false),
label: 'grass',
@@ -88,6 +116,8 @@ button.without-icon i {
border-right: solid 3px #333333;
}
.hexTop,
.hexBottom {
position: absolute;
@@ -149,6 +179,70 @@ 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;
}
.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;
}
}
}
.shifted{
.viewBorderRight{
.hexTop{
border-right: dashed 3px blue;
}
.hexBottom{
border-bottom: dashed 3px blue;
}
.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;
}
}
}
.barren {
background-image: url("../assets/tiles/barren_tile.webp");
button {
@@ -249,4 +343,20 @@ 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;
}
.centerTile {
z-index: 1002;
border-left: solid 3px red;
border-right: solid 3px red;
}
</style>
Loading