Skip to content

Commit

Permalink
Merge pull request #644 from phrack/641fix
Browse files Browse the repository at this point in the history
Fixes #641 and fixes #643.  Fixes click to shot
  • Loading branch information
phrack authored Oct 26, 2016
2 parents 95874c1 + dc83f26 commit 1f0b51a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/shootoff/camera/CameraManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,22 @@ public void setFeedResolution(int width, int height) {

// Used by click-to-shoot and tests to inject a shot via the shot detector
public void injectShot(ShotColor color, double x, double y, boolean scaleShot) {
shotDetector.addShot(color, x, y, getCurrentFrameTimestamp(), scaleShot);
shotDetector.addShot(color, x, y, System.currentTimeMillis(), scaleShot);
}

public void clearShots() {
cameraView.clearShots();
}

public void reset() {
resetStartTime();
resetStartTime(0);
shotDetector.reset();
deduplicationProcessor.reset();
cameraView.reset();
}

private void resetStartTime() {
startTime = System.currentTimeMillis();
private void resetStartTime(long timestamp) {
startTime = timestamp;
}

@Override
Expand Down Expand Up @@ -779,7 +779,7 @@ public int getFrameCount() {

public long getCurrentFrameTimestamp() {
if (startTime == 0) {
resetStartTime();
resetStartTime(System.currentTimeMillis());
return 0;
}

Expand All @@ -788,7 +788,7 @@ public long getCurrentFrameTimestamp() {

public long cameraTimeToShotTime(long timestamp) {
if (startTime == 0) {
resetStartTime();
resetStartTime(timestamp);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/shootoff/gui/CanvasManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public CanvasManager(Group canvasGroup, Resetter resetter, String cameraName,
// addArenaShot when they go through the arena camera feed's
// canvas manager
if (this instanceof MirroredCanvasManager) {
final long shotTimestamp = cameraManager == null ? 0 : cameraManager.getCurrentFrameTimestamp();
final long shotTimestamp = System.currentTimeMillis();

addShot(new Shot(shotColor, event.getX(), event.getY(), shotTimestamp, config.getMarkerRadius()),
false);
Expand Down

0 comments on commit 1f0b51a

Please sign in to comment.