Skip to content

Problems with zoom #12

@activityworkshop

Description

@activityworkshop

I found some zoom problems with the jar LogicSim-3.4-20200611, maybe you can have a look.

Problem 1: if the canvas is empty, then clicking the "zoom to all" button on the toolbar results in a NullPointerException, because the Rectangle is still null:
Cannot invoke "java.awt.geom.Rectangle2D.getX()" because "" is null at logicsim.Circuit.getBoundingBox
That one should be easy to fix, just do a check if the canvas is empty and then either do nothing or zoom to some predefined rectangle instead.

Problem 2: if I put an element on the left of the window, and a second element over on the right, then I'd expect "zoom to all" to show me both, with them centred in the pane. Instead, the right-hand element disappears off the right side of the pane, and the left-hand element is somewhere in the lower left of the pane. It seems like the calculation of the zoom and/or the centre coordinates is wrong?

Problem 3: if I press "zoom to all" again, then both disappear off the bottom of the screen - this is perhaps the same as problem 2.

Problem 4: sometimes when I drag the screen to try to bring the circuit back into view again, it suddenly shows "X:-2147483640, Y:-2147483640" in the status bar, and now everything seems frozen. Even reloading the file doesn't help, I have to close the program and start it again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions