const n = 34;
const zoomConfig = {
levels: [
{
name: “DefaultLevel”,
min_column_width: n,
scales: [
{ unit: ‘day’, step: 1, date: ‘%j’, css: daysStyle },
{ unit: “month”, step: 1, format: “%M %Y”, css: daysStyle },
]
},
{
name: “ZoomOutLevel1”,
min_column_width: n + 8,
scales: [
{ unit: ‘day’, step: 1, date: ‘%j’, css: daysStyle },
{ unit: “month”, step: 1, format: “%M %Y”, css: daysStyle },
]
},
{
name: “ZoomOutLevel2”,
min_column_width: n + 16,
scales: [
{ unit: ‘day’, step: 1, date: ‘%j’, css: daysStyle },
{ unit: “month”, step: 1, format: “%M %Y”, css: daysStyle },
]
},
{
name: “ZoomInLevel1”,
min_column_width: n - 8,
scales: [
{ unit: ‘day’, step: 1, date: ‘%j’, css: daysStyle },
{ unit: “month”, step: 1, format: “%M %Y”, css: daysStyle },
]
},
{
name: “ZoomInLevel2”,
min_column_width: n - 16,
scales: [
{ unit: ‘day’, step: 1, date: ‘%j’, css: daysStyle },
{ unit: “month”, step: 1, format: “%M %Y”, css: daysStyle },
]
},
],
element: function () {
return gantt.$root.querySelector(“.gantt_task”);
},
};
showZoomInAlert: () => {
gantt.ext.zoom.init(zoomConfig);
if (currentZoomLevel === "DefaultLevel") {
currentZoomLevel = "ZoomInLevel1";
} else if (currentZoomLevel === "ZoomInLevel1") {
currentZoomLevel = "ZoomInLevel2";
} else {
}
gantt.ext.zoom.setLevel(currentZoomLevel);
},
showZoomOutAlert: () => {
gantt.ext.zoom.init(zoomConfig);
if (currentZoomLevel === "DefaultLevel") {
currentZoomLevel = "ZoomOutLevel1";
} else if (currentZoomLevel === "ZoomOutLevel1") {
currentZoomLevel = "ZoomOutLevel2";
} else {
}
gantt.ext.zoom.setLevel(currentZoomLevel);
},
I want to implement a functionality where initially there is a default minimum column width. When someone clicks on the zoom out icon, it should increase the minimum column width by 8, and clicking again should further increase it by 8. When clicking on the zoom in icon, it should decrease the current column width by 8, and clicking again should decrease it by 8 again. Clicking again after reaching the minimum width should disable the action. To return to the normal view, clicking on zoom out should increase the width by 8, and vice versa.
plz help me @ramil @Anton_Marchenko @ArtyomBorisevich