Browse Source

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

master
Victor Giers 1 year 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

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

+ 12
- 7
scancropper2.pde View File

@@ -4,6 +4,8 @@ SDrop drop;
Bounder bounder;
int imageNo = 0;
int imageAmount;


String[] imagePaths;
PImage[] images;
PImage imageThumb;
@@ -17,6 +19,7 @@ void setup() {
drop = new SDrop(this);
surface.setResizable(true);
bounder = new Bounder();
noLoop();
}

void draw() {
@@ -26,8 +29,7 @@ void draw() {

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

@@ -45,7 +47,7 @@ void keyPressed() {
}
}
if (key == ' ') {
if(bounder.state == 3) bounder.compile(false);
if (bounder.state == 3) bounder.compile(false);
bounder.state = 0;
println("Bounder reset");
}
@@ -63,6 +65,7 @@ void keyPressed() {
println(imageNo);
}
}
redraw();
}

void mousePressed() {
@@ -70,10 +73,11 @@ void mousePressed() {
}

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

void dropEvent(DropEvent theDropEvent) {
@@ -85,12 +89,12 @@ void dropEvent(DropEvent theDropEvent) {
println(droppedFiles);
folderURI = droppedFiles[0].getParent();
println(folderURI);
ArrayList<String> imgs = new ArrayList<String>();
imageAmount = 0;
for (int i = 0; i < droppedFiles.length; i++) {
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());
}
imageAmount = imgs.size();
@@ -98,8 +102,9 @@ void dropEvent(DropEvent theDropEvent) {
imagePaths = imgs.toArray(imagePaths);
imagePaths = sort(imagePaths);
images = new PImage[imageAmount];
if(imageNo++ <= imageAmount) imageNo++; //open on page 2
setImage(imageNo);
surface.setSize(displayWidth, displayHeight);
}
}
}

Loading…
Cancel
Save