pencil icon indicating copy to clipboard operation
pencil copied to clipboard

window starts taller than screen on win 7

Open r-a-v-a-s opened this issue 9 years ago • 2 comments

The first time I started the program it was taller than my screen. I could not see the menu bar or title bar. Fortunately, I use a window re-sizing / re-positioning autohotkey script... ;-]

1920x1080 resolution on win 7 pro

:four_leaf_clover:

r-a-v-a-s avatar Aug 11 '15 07:08 r-a-v-a-s

I can reproduce this on Windows 10, same resolution.

bitzl avatar Feb 21 '16 23:02 bitzl

I found these, but don't have enough experience with the code.

mainWindow.js

Pencil.getBestFitSize = function () {
    var mainViewPanel = document.getElementById("mainViewPanel");
    var zoom = Pencil.activeCanvas ? (1 / Pencil.activeCanvas.zoom) : 1;
    return [zoom * (mainViewPanel.boxObject.width - Pencil._getCanvasPadding()), zoom * (mainViewPanel.boxObject.height - Pencil._getCanvasPadding())].join("x");
};
Pencil.getBestFitSizeObject = function () {
    var mainViewPanel = document.getElementById("mainViewPanel");
    var zoom = Pencil.activeCanvas ? (1 / Pencil.activeCanvas.zoom) : 1;
    return {width: zoom * (mainViewPanel.boxObject.width - Pencil._getCanvasPadding()), height: zoom * (mainViewPanel.boxObject.height - Pencil._getCanvasPadding())};
};

controller.js

Controller.prototype.sizeToBestFit = function (passedPage) {
    var page = passedPage ? passedPage : this.getCurrentPage();
    var canvas = page._view.canvas;
    if (!canvas) return;

    var newSize = Pencil.getBestFitSizeObject();
    if (newSize) {
        canvas.setSize(newSize.width, newSize.height);
        page.properties.width = newSize.width;
        page.properties.height = newSize.height;
        Config.set("lastSize", [newSize.width, newSize.height].join("x"));
    }
};

r-a-v-a-s avatar Feb 22 '16 01:02 r-a-v-a-s