diff Applications/StoneWebViewer/WebApplication/app.js @ 1968:ed5a0b9183dc

The text field with the instance number is editable to go to a specific instance
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 10:56:34 +0200
parents b180233143ae
children 0aac8f552d89
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Fri Oct 28 10:38:30 2022 +0200
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Fri Oct 28 10:56:34 2022 +0200
@@ -141,6 +141,7 @@
       stone: stone,  // To access global object "stone" from "index.html"
       status: 'waiting',
       currentFrame: 0,
+      currentFrameFromUser: 0,
       numberOfFrames: 0,
       quality: '',
       cineControls: false,
@@ -158,6 +159,7 @@
   },
   watch: {
     currentFrame: function(newVal, oldVal) {
+      this.currentFrameFromUser = newVal + 1;
       if (this.cineLoadingFrame) {
         /**
          * The "FrameUpdated" event has been received, which indicates
@@ -169,6 +171,13 @@
         stone.SetFrame(this.canvasId, newVal);
       }
     },
+    currentFrameFromUser: function(newVal, oldVal) {
+      if (parseInt(newVal, 10) !== NaN &&
+          newVal >= 1 &&
+          newVal <= this.numberOfFrames) {
+        this.currentFrame = this.currentFrameFromUser - 1;
+      }
+    },
     content: function(newVal, oldVal) {
       this.status = 'loading';
       this.cineControls = false;