improved entity positioning accuracy

This commit is contained in:
Bachir Soussi Chiadmi 2023-04-18 11:54:08 +02:00
parent 4708f9bfe1
commit e81913c2e1
2 changed files with 5 additions and 4 deletions

View File

@ -355,6 +355,7 @@ div.field--name-field-menace-maintien label{
/* width:100%; */ /* width:100%; */
max-height: calc(100vh - 150px); max-height: calc(100vh - 150px);
position: relative; position: relative;
padding: 8%;
} }
#boussole-layout .boussole-wrapper .boussole .entity{ #boussole-layout .boussole-wrapper .boussole .entity{
position: absolute; position: absolute;

View File

@ -247,8 +247,8 @@
this.values.mm.value = this.values.mm.$dom.value = a; this.values.mm.value = this.values.mm.$dom.value = a;
// https://stackoverflow.com/questions/5731863/mapping-a-numeric-range-onto-another // https://stackoverflow.com/questions/5731863/mapping-a-numeric-range-onto-another
// from range 0 -> rayon_de_la_boussole to range 0 -> 100 // from range 0 -> rayon_de_la_boussole moins 8% de padding |to| range 0 -> 100
let r_max = this.sceneSize.w/2; let r_max = this.sceneSize.w/2 * 0.92;
let r_slope = (100 - 0) / (r_max - 0); let r_slope = (100 - 0) / (r_max - 0);
this.values.p.value = this.values.p.$dom.value = 100 - parseFloat(0 + r_slope * (r - 0)).toFixed(2); this.values.p.value = this.values.p.$dom.value = 100 - parseFloat(0 + r_slope * (r - 0)).toFixed(2);
// this.values.p.$dom.value = this.values.p.value; // this.values.p.$dom.value = this.values.p.value;
@ -290,8 +290,8 @@
// from range 0 -> 100 to range 0 -> diagonale de la scene // from range 0 -> 100 to range 0 -> diagonale de la scene
// let diagonale = Math.sqrt(Math.pow(this.sceneSize.w, 2) + Math.pow(this.sceneSize.h, 2))/2; // let diagonale = Math.sqrt(Math.pow(this.sceneSize.w, 2) + Math.pow(this.sceneSize.h, 2))/2;
// let r_max = diagonale; // let r_max = diagonale;
// actualy we don't use diagonale, we stay on the circle // actualy we don't use diagonale, we stay on the circle less 8% padding to get 100 on the external circle
let r_max = this.sceneSize.w/2; let r_max = this.sceneSize.w/2 * 0.92;
let r_slope = (r_max - 0) / (100 - 0) let r_slope = (r_max - 0) / (100 - 0)
// we inverse p as the more p you have the closest you are from the center // we inverse p as the more p you have the closest you are from the center
let r = parseInt(0 + r_slope * ((100 - this.values.p.value) - 0)); let r = parseInt(0 + r_slope * ((100 - this.values.p.value) - 0));