we can now zoom in the opened terrain de vie

This commit is contained in:
2024-02-05 16:52:05 +01:00
parent 7984c9c7d0
commit 8518ebf7df
4 changed files with 64 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ export default {
salientPoints: [],
scale: 1,
prev_scale: 1,
details_zoom_scale: 1,
opacity: 0,
tween: null,
is_visible: true,
@@ -68,7 +69,8 @@ export default {
'allSuperpositions_clustered',
'allMapItems_byid',
'opened_concernement',
'opened_entite_id']),
'opened_entite_id',
'detailsZoomValue']),
...mapState(CommonStore,['hover_elmt',
'map_item_ray',
'cartouch_width',
@@ -269,6 +271,15 @@ export default {
this.updatePaperObjectSize();
},
deep: true
},
detailsZoomValue: {
handler (n, o) {
if (this.is_open) {
console.log('map_item detailsZoomValue watch', n);
this.updateDetailsZoomScale()
}
},
deep: true
}
},
methods: {
@@ -689,6 +700,18 @@ export default {
this.paper_main_object.addChild(this.setPaperContour());
},
updateDetailsZoomScale(){
// revert to the original scale (by reverting the previous scale)
this.paper_main_object.scale(1 / this.details_zoom_scale);
// compute the zoom scale
this.details_zoom_scale = this.scale * this.detailsZoomValue;
// then scale again to new scale
this.paper_main_object.scale(this.details_zoom_scale);
// // handle superposition scaling
// this.resetSuperpositionsConstraintsScaling(s);
// this.prev_scale = this.scale = s;
},
/*
* called by openClose() function
*/
@@ -2156,6 +2179,7 @@ export default {
// record new scale
this.prev_scale = this.scale;
this.scale = this.mapitem.scale = obj.s;
this.details_zoom_scale = this.scale * this.detailsZoomValue;
this.opacity = obj.o;
// console.log('tween update obj.s', obj.s);
this.pos = {x:obj.x, y:obj.y};
@@ -2165,6 +2189,7 @@ export default {
// console.log('tween complete obj.s', obj.s);
// record tween one last time
this.prev_scale = this.scale = obj.s;
this.details_zoom_scale = this.scale * this.detailsZoomValue;
this.mapitem.scale = this.scale;
this.opacity = obj.o;
this.pos = {x:obj.x, y:obj.y};
@@ -2258,11 +2283,13 @@ export default {
this.prev_scale = this.scale;
this.scale = obj.s;
this.mapitem.scale = this.scale;
this.details_zoom_scale = this.scale * this.detailsZoomValue;
this.opacity = obj.o;
})
.onComplete((obj) => {
this.prev_scale = this.scale = 1;
this.mapitem.scale = this.scale;
this.details_zoom_scale = this.scale * this.detailsZoomValue;
this.handlePaperVisibilityOnClosed();
this.clearPaperContents();
this.is_closing = false;
@@ -2324,6 +2351,7 @@ export default {
this.resetSuperpositionsConstraintsScaling(s);
// record the new scale
this.prev_scale = this.scale = s;
this.details_zoom_scale = this.scale * this.detailsZoomValue;
},
// ENGINE UPDATE
onBeforeEngineUpdate (event) {