Browse Source

auto fullscreen after folder load, open on page 2 by default

master
Victor Giers 3 years ago
parent
commit
175225f092
2 changed files with 14 additions and 9 deletions
  1. 2
    2
      bounder.pde
  2. 12
    7
      scancropper2.pde

+ 2
- 2
bounder.pde View File

if (state < 4) state++; if (state < 4) state++;
if (state == 1) { if (state == 1) {
p1 = new PVector(mouseX, mouseY); p1 = new PVector(mouseX, mouseY);
loop();
} }
if (state == 2) { if (state == 2) {
p2 = new PVector(mouseX, mouseY); p2 = new PVector(mouseX, mouseY);
} }
if (state == 3) { if (state == 3) {
h = -p2.dist(new PVector(mouseX, mouseY)); h = -p2.dist(new PVector(mouseX, mouseY));
noLoop();
} }
} }
void update() { void update() {

+ 12
- 7
scancropper2.pde View File

Bounder bounder; Bounder bounder;
int imageNo = 0; int imageNo = 0;
int imageAmount; int imageAmount;


String[] imagePaths; String[] imagePaths;
PImage[] images; PImage[] images;
PImage imageThumb; PImage imageThumb;
drop = new SDrop(this); drop = new SDrop(this);
surface.setResizable(true); surface.setResizable(true);
bounder = new Bounder(); bounder = new Bounder();
noLoop();
} }


void draw() { void draw() {


if (imageLoaded) { if (imageLoaded) {
if (images[imageNo] != null) { if (images[imageNo] != null) {
// image(images[imageNo], 0, 0, width, height);
image(imageThumb, 0, 0, width, height);
image(imageThumb, 0, 0, width, height);
} }
} }


} }
} }
if (key == ' ') { if (key == ' ') {
if(bounder.state == 3) bounder.compile(false);
if (bounder.state == 3) bounder.compile(false);
bounder.state = 0; bounder.state = 0;
println("Bounder reset"); println("Bounder reset");
} }
println(imageNo); println(imageNo);
} }
} }
redraw();
} }


void mousePressed() { void mousePressed() {
} }


void setImage(int i) { void setImage(int i) {
images[i] = loadImage(imagePaths[imageNo]);
images[i] = loadImage(imagePaths[i]);
imageThumb = images[i].get(); imageThumb = images[i].get();
imageThumb.resize(images[i].width/7, images[i].height/7); imageThumb.resize(images[i].width/7, images[i].height/7);
imageLoaded = true; imageLoaded = true;
redraw();
} }


void dropEvent(DropEvent theDropEvent) { void dropEvent(DropEvent theDropEvent) {
println(droppedFiles); println(droppedFiles);
folderURI = droppedFiles[0].getParent(); folderURI = droppedFiles[0].getParent();
println(folderURI); println(folderURI);
ArrayList<String> imgs = new ArrayList<String>(); ArrayList<String> imgs = new ArrayList<String>();
imageAmount = 0; imageAmount = 0;
for (int i = 0; i < droppedFiles.length; i++) { for (int i = 0; i < droppedFiles.length; i++) {
String fn = droppedFiles[i].toString().toLowerCase(); String fn = droppedFiles[i].toString().toLowerCase();
if(fn.endsWith(".jpg") || fn.endsWith(".jpeg") || fn.endsWith(".bmp") || fn.endsWith(".png") || fn.endsWith(".gif"))
if (fn.endsWith(".jpg") || fn.endsWith(".jpeg") || fn.endsWith(".bmp") || fn.endsWith(".png") || fn.endsWith(".gif"))
imgs.add(droppedFiles[i].toString()); imgs.add(droppedFiles[i].toString());
} }
imageAmount = imgs.size(); imageAmount = imgs.size();
imagePaths = imgs.toArray(imagePaths); imagePaths = imgs.toArray(imagePaths);
imagePaths = sort(imagePaths); imagePaths = sort(imagePaths);
images = new PImage[imageAmount]; images = new PImage[imageAmount];
if(imageNo++ <= imageAmount) imageNo++; //open on page 2
setImage(imageNo); setImage(imageNo);
surface.setSize(displayWidth, displayHeight);
} }
} }
} }

Loading…
Cancel
Save