better responsivness #2416
This commit is contained in:
parent
b2614bf755
commit
609964b358
@ -196,6 +196,8 @@ export default {
|
|||||||
// if map_item is open and we change the mad mode, redefined what is displayed in the "boussole"
|
// if map_item is open and we change the mad mode, redefined what is displayed in the "boussole"
|
||||||
if (this.is_open & n !== o) {
|
if (this.is_open & n !== o) {
|
||||||
this.setPaperContents();
|
this.setPaperContents();
|
||||||
|
this.resetMapItemPosition();
|
||||||
|
this.resetMapItemScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clones visibility
|
// Clones visibility
|
||||||
@ -264,7 +266,7 @@ export default {
|
|||||||
console.log(`map_item_ray updated o: ${o}, n: ${n}`);
|
console.log(`map_item_ray updated o: ${o}, n: ${n}`);
|
||||||
this.ray = n;
|
this.ray = n;
|
||||||
this.updateMatterBodyRay();
|
this.updateMatterBodyRay();
|
||||||
this.updatePaperObjectSize(n,o);
|
this.updatePaperObjectSize();
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
@ -644,7 +646,7 @@ export default {
|
|||||||
|
|
||||||
this.initPaperEvents()
|
this.initPaperEvents()
|
||||||
},
|
},
|
||||||
async updatePaperObjectSize(n,o){
|
async updatePaperObjectSize(){
|
||||||
await nextTick();
|
await nextTick();
|
||||||
// INFO we redraw the points with the new ray AND sacle the backgrounds ... would it be simplier to only resize the whole mapitem ???
|
// INFO we redraw the points with the new ray AND sacle the backgrounds ... would it be simplier to only resize the whole mapitem ???
|
||||||
// window has been resized
|
// window has been resized
|
||||||
@ -654,6 +656,7 @@ export default {
|
|||||||
if (this.is_open) {
|
if (this.is_open) {
|
||||||
// move to the new position
|
// move to the new position
|
||||||
// INFO we need to change position first for the contours to be redraw in the right place
|
// INFO we need to change position first for the contours to be redraw in the right place
|
||||||
|
// this.resetMapItemPosition();
|
||||||
this.pos = this.paper_main_object.position = {
|
this.pos = this.paper_main_object.position = {
|
||||||
x: (this.canvas.width - this.cartouch_width) / 2,
|
x: (this.canvas.width - this.cartouch_width) / 2,
|
||||||
y: this.canvas.height / 2
|
y: this.canvas.height / 2
|
||||||
@ -2107,7 +2110,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// OPEN / CLOSE (with tween)
|
// OPEN / CLOSE (with tween)
|
||||||
getOpeningAvailableScale(){
|
getOpeningAvailableScale(){
|
||||||
// calcul opened size regarding window size and surounding contents
|
// calcul opened size regarding window size and surounding contents
|
||||||
let header = document.querySelector('header#header');
|
let header = document.querySelector('header#header');
|
||||||
let header_height = header.clientHeight;
|
let header_height = header.clientHeight;
|
||||||
let map_nav = document.querySelector('nav#map-nav');
|
let map_nav = document.querySelector('nav#map-nav');
|
||||||
@ -2295,6 +2298,29 @@ export default {
|
|||||||
}
|
}
|
||||||
this.tween.easing(Tween.Easing.Quadratic.InOut).start();
|
this.tween.easing(Tween.Easing.Quadratic.InOut).start();
|
||||||
},
|
},
|
||||||
|
async resetMapItemPosition(){
|
||||||
|
await nextTick();
|
||||||
|
console.log('resetMapItemPosition');
|
||||||
|
this.pos = this.paper_main_object.position = {
|
||||||
|
x: (this.canvas.width - this.cartouch_width) / 2,
|
||||||
|
y: this.canvas.height / 2
|
||||||
|
};
|
||||||
|
this.constraint.pointA = this.pos;
|
||||||
|
console.log('resetMapItemPosition', this.cartouch_width, this.pos);
|
||||||
|
Matter.Body.setPosition(this.body, this.pos);
|
||||||
|
},
|
||||||
|
async resetMapItemScale(){
|
||||||
|
await nextTick();
|
||||||
|
console.log('resetMapItemScale');
|
||||||
|
let s = this.getOpeningAvailableScale();
|
||||||
|
// revert to the original scale (by reverting the previous scale)
|
||||||
|
this.paper_main_object.scale(1 / this.scale);
|
||||||
|
// then scale again to new scale
|
||||||
|
this.paper_main_object.scale(s);
|
||||||
|
this.prev_scale = this.scale = s;
|
||||||
|
|
||||||
|
// TODO handle superposition scaling
|
||||||
|
},
|
||||||
// ENGINE UPDATE
|
// ENGINE UPDATE
|
||||||
onBeforeEngineUpdate (event) {
|
onBeforeEngineUpdate (event) {
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export const CommonStore = defineStore({
|
|||||||
},
|
},
|
||||||
setCartoucheWidth (delta) {
|
setCartoucheWidth (delta) {
|
||||||
console.log('CommonStore setCartoucheWidth', delta);
|
console.log('CommonStore setCartoucheWidth', delta);
|
||||||
this.cartouch_width = this.original_cartouch_width * delta;
|
this.cartouch_width = this.original_cartouch_width * delta + 8 * (delta+1);
|
||||||
},
|
},
|
||||||
setCartoucheOpened (v) {
|
setCartoucheOpened (v) {
|
||||||
console.log('setCartoucheOpened', v);
|
console.log('setCartoucheOpened', v);
|
||||||
|
@ -149,6 +149,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
},
|
||||||
|
map_mode: {
|
||||||
|
handler (n, o) {
|
||||||
|
console.log('concernement watch map_mode', o, n);
|
||||||
|
if(n === "proximite" || n === "superposition"){
|
||||||
|
// as we have two content to show multiply the cartouch with by 2
|
||||||
|
// necessary for mapitem opening scale and position
|
||||||
|
this.setCartoucheWidth(2)
|
||||||
|
}else{
|
||||||
|
// as we have one content to show multiply the cartouch with by 1
|
||||||
|
// necessary for mapitem opening scale and position
|
||||||
|
this.setCartoucheWidth(1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user