fixed concernements display on canvas
This commit is contained in:
parent
1124ee2dc9
commit
80786f55bd
@ -49,15 +49,12 @@ export default {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="main-content">
|
<div id="main-content">
|
||||||
<MapConcernements v-if="isloggedin">
|
<MapConcernements>
|
||||||
<ConcernementMapItem
|
<ConcernementMapItem
|
||||||
v-for="concernement in concernements"
|
v-for="concernement in concernements"
|
||||||
:key="concernement.id"
|
:key="concernement.id"
|
||||||
:concernement="concernement"
|
:concernement="concernement"
|
||||||
/>
|
/>
|
||||||
<!-- <ConcernementMapItem
|
|
||||||
:concernement="concernements[0]"
|
|
||||||
/> -->
|
|
||||||
</MapConcernements>
|
</MapConcernements>
|
||||||
<div id="content" class="row">
|
<div id="content" class="row">
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
@ -30,6 +30,9 @@ export default {
|
|||||||
this.entites = this.concernement.entites
|
this.entites = this.concernement.entites
|
||||||
this.parsePoints()
|
this.parsePoints()
|
||||||
this.getSalientPoints()
|
this.getSalientPoints()
|
||||||
|
if (this.canvasMap) {
|
||||||
|
this.initCanvasMap()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// canvasMap (n, o) {
|
// canvasMap (n, o) {
|
||||||
@ -37,7 +40,16 @@ export default {
|
|||||||
// }
|
// }
|
||||||
canvasMap: {
|
canvasMap: {
|
||||||
handler (n, o){
|
handler (n, o){
|
||||||
// console.log("concernementItem watch canvasMap.ctx", o, n);
|
console.log("concernementItem watch canvasMap.ctx", o, n);
|
||||||
|
if (!this.canvas) {
|
||||||
|
this.initCanvasMap()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initCanvasMap (){
|
||||||
this.canvas = this.canvasMap.canvas
|
this.canvas = this.canvasMap.canvas
|
||||||
this.ctx = this.canvasMap.ctx
|
this.ctx = this.canvasMap.ctx
|
||||||
this.pos.x = this.ray/2 + Math.random()*(this.canvas.width - this.ray)
|
this.pos.x = this.ray/2 + Math.random()*(this.canvas.width - this.ray)
|
||||||
@ -45,11 +57,8 @@ export default {
|
|||||||
// listen for animate event dispatched from parent
|
// listen for animate event dispatched from parent
|
||||||
this.canvas.addEventListener('animate', this.animate)
|
this.canvas.addEventListener('animate', this.animate)
|
||||||
},
|
},
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
parsePoints (){
|
parsePoints (){
|
||||||
|
// converts data (menace/maintien, actuel/future, prise) into atcual position x,y
|
||||||
for (let i = 0; i < this.entites.length; i++) {
|
for (let i = 0; i < this.entites.length; i++) {
|
||||||
let entite = this.entites[i]
|
let entite = this.entites[i]
|
||||||
// console.log('entite', entite);
|
// console.log('entite', entite);
|
||||||
@ -88,7 +97,7 @@ export default {
|
|||||||
getSalientPoints () {
|
getSalientPoints () {
|
||||||
// debugger
|
// debugger
|
||||||
// console.log(this.entites);
|
// console.log(this.entites);
|
||||||
let arc = 60;
|
let arc = 360/12;
|
||||||
// loop through arcs
|
// loop through arcs
|
||||||
for (let i = 0; i <= 360/arc; i++) {
|
for (let i = 0; i <= 360/arc; i++) {
|
||||||
// loop through entities to find the farest on the arc
|
// loop through entities to find the farest on the arc
|
||||||
@ -109,7 +118,7 @@ export default {
|
|||||||
this.salientPoints.push(farest.display)
|
this.salientPoints.push(farest.display)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log('this.salientPoints', this.salientPoints);
|
console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints);
|
||||||
},
|
},
|
||||||
animate () {
|
animate () {
|
||||||
if (this.ctx) {
|
if (this.ctx) {
|
||||||
@ -120,7 +129,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
// console.log('render()');
|
// console.log('render()', this.ctx);
|
||||||
|
|
||||||
if (!this.ctx) return;
|
if (!this.ctx) return;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initGradients()
|
// this.initGradients()
|
||||||
this.initTrame()
|
this.initTrame()
|
||||||
},
|
},
|
||||||
// computed: {
|
// computed: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user