I have been working on this code that takes and image and let’s me zoom in using the scale() function tied to the mouse wheel. And, I can drag the image around the screen using the translate((width/2)+x, (height/2)+y) function with x & y being updated by the void mousePressed() and void mouseDragged(). So far the code works great but I would like to limit the amount I can translate the the image to the size of the screen.
So if the scale is “1.00” I can’t move the image at all and if the scale is 1.05 I can only move the image ((width*Scale)-width/2). My background is black and I never want to see it. I have tried adding an if statement in the void mouseDragged() function but it does not work well.
I have the following code that pulls polygon objects out of an xml document and draws them to the screen using the beginShape(), vertex(xMap, yMap), endShape(). I would like to put these objects into a Polygon class with the name of each polygon “the polygons are real building outlines with names” and an array for both the x and y coordinates. I want to due this because cycling through the xml document to draw my polygons kills the performance of my processing sketch and I’m thinking a class would be quicker. I’m not sure how to pass the data.
I would think it would be something like:
Polygon(name, xMap[], yMap[]);