Skip to content

Commit d17e946

Browse files
committed
fix fit function
1 parent 110c34f commit d17e946

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

web/src/components/DbmlGraph.vue

-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ import { store } from 'quasar/wrappers'
260260
}
261261
262262
}
263-
console.log(chart.getZoom,chart.getPan,startPan.value)
264263
chart.updatePan(startPan.value)
265264
// do nothing
266265
}

web/src/components/VDbChart/VDbChart.vue

+11-4
Original file line numberDiff line numberDiff line change
@@ -357,18 +357,25 @@
357357
//panZoom.value.resize()
358358
let s = panZoom.value.getSizes();
359359
let z = store.zoom
360+
let zHeight = 1
361+
let cor = 0;
362+
if (newPan.diagram.height > s.height){
363+
zHeight = s.height / newPan.diagram.height
364+
cor = (1-zHeight);
365+
} else {
366+
cor = 0.04
367+
}
360368
if (newPan.diagram.width > s.width){
361369
z = s.width / newPan.diagram.width
370+
362371
}
363-
if (newPan.diagram.height > s.height){
364-
z = s.height / newPan.diagram.height
365-
}
372+
z = z - cor
366373
const p = panZoom.value.getPan()
367374
const pan = {
368375
x: p.x - (s.width / 2),
369376
y: p.y - (s.height / 2)
370377
}
371-
z = z - 0.04;
378+
z = z;
372379
store.$patch({
373380
pan: pan,
374381
zoom: z

0 commit comments

Comments
 (0)