Skip to content

Commit 1f0b51a

Browse files
authored
Merge pull request #644 from phrack/641fix
Fixes #641 and fixes #643. Fixes click to shot
2 parents 95874c1 + dc83f26 commit 1f0b51a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/java/com/shootoff/camera/CameraManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,22 +257,22 @@ public void setFeedResolution(int width, int height) {
257257

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

263263
public void clearShots() {
264264
cameraView.clearShots();
265265
}
266266

267267
public void reset() {
268-
resetStartTime();
268+
resetStartTime(0);
269269
shotDetector.reset();
270270
deduplicationProcessor.reset();
271271
cameraView.reset();
272272
}
273273

274-
private void resetStartTime() {
275-
startTime = System.currentTimeMillis();
274+
private void resetStartTime(long timestamp) {
275+
startTime = timestamp;
276276
}
277277

278278
@Override
@@ -779,7 +779,7 @@ public int getFrameCount() {
779779

780780
public long getCurrentFrameTimestamp() {
781781
if (startTime == 0) {
782-
resetStartTime();
782+
resetStartTime(System.currentTimeMillis());
783783
return 0;
784784
}
785785

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

789789
public long cameraTimeToShotTime(long timestamp) {
790790
if (startTime == 0) {
791-
resetStartTime();
791+
resetStartTime(timestamp);
792792
return 0;
793793
}
794794

src/main/java/com/shootoff/gui/CanvasManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public CanvasManager(Group canvasGroup, Resetter resetter, String cameraName,
161161
// addArenaShot when they go through the arena camera feed's
162162
// canvas manager
163163
if (this instanceof MirroredCanvasManager) {
164-
final long shotTimestamp = cameraManager == null ? 0 : cameraManager.getCurrentFrameTimestamp();
164+
final long shotTimestamp = System.currentTimeMillis();
165165

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

0 commit comments

Comments
 (0)