|
@@ -35,79 +35,90 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import InputWithUnits from "./InputWithUnits.vue";
|
|
|
- export default {
|
|
|
- name: "GetSourceParameters",
|
|
|
- components: {
|
|
|
- InputWithUnits
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- // TODO: Is it OK to modify Local later?
|
|
|
- fromWLLocal: this.fromWL,
|
|
|
- toWLLocal: this.toWL,
|
|
|
- stepWLLocal: this.stepWL,
|
|
|
- pointsNum: 100,
|
|
|
- isStep: true
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
+import InputWithUnits from "./InputWithUnits.vue";
|
|
|
+export default {
|
|
|
+ name: "GetSourceParameters",
|
|
|
+ components: {
|
|
|
+ InputWithUnits
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ // TODO: Is it OK to modify Local later?
|
|
|
+ fromWLLocal: this.fromWL,
|
|
|
+ toWLLocal: this.toWL,
|
|
|
+ stepWLLocal: this.stepWL,
|
|
|
+ pointsNum: 100,
|
|
|
+ isStep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isStep: {
|
|
|
+ handler: function () {
|
|
|
+ if (this.isStep) {
|
|
|
+ this.stepWLLocal = (this.toWLLocal-this.fromWLLocal)/this.pointsNum;
|
|
|
+ } else {
|
|
|
+ this.pointsNum = parseInt(Math.round((this.toWLLocal-this.fromWLLocal)/this.stepWLLocal));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // emit updated values
|
|
|
+ fromWLLocal: {
|
|
|
+ handler: function () {
|
|
|
+ this.fromWLLocal = parseFloat(this.fromWLLocal);
|
|
|
+ this.stepWLLocal = (this.toWLLocal-this.fromWLLocal)/this.pointsNum;
|
|
|
+ // if (this.fromWLLocal > this.toWLLocal) {
|
|
|
+ // this.fromWLLocal = this.toWLLocal;
|
|
|
+ // }
|
|
|
+ this.$emit('fromWLData',this.fromWLLocal);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toWLLocal: {
|
|
|
+ handler: function () {
|
|
|
+ this.toWLLocal = parseFloat(this.toWLLocal);
|
|
|
+ this.stepWLLocal = (this.toWLLocal-this.fromWLLocal)/this.pointsNum;
|
|
|
+ // if (this.toWLLocal < this.fromWLLocal) {
|
|
|
+ // this.toWLLocal = this.fromWLLocal;
|
|
|
+ // }
|
|
|
+ this.$emit('toWLData',this.toWLLocal);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ pointsNum: {
|
|
|
+ handler: function () {
|
|
|
+ this.pointsNum = parseInt(this.pointsNum);
|
|
|
+ this.stepWLLocal = (this.toWLLocal - this.fromWLLocal) / this.pointsNum;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ stepWLLocal: {
|
|
|
+ handler: function () {
|
|
|
+ this.$emit('stepWLData',this.stepWLLocal);
|
|
|
+ this.pointsNum = parseInt(Math.round((this.toWLLocal-this.fromWLLocal)/this.stepWLLocal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // update local values
|
|
|
+ fromWL: {
|
|
|
+ handler: function () {
|
|
|
+ this.fromWLLocal = this.fromWL;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toWL: {
|
|
|
+ handler: function () {
|
|
|
+ this.toWLLocal = this.toWL;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ stepWL: {
|
|
|
+ handler: function () {
|
|
|
+ this.stepWLLocal = this.stepWL;
|
|
|
+ this.pointsNum = parseInt(Math.round((this.toWLLocal-this.fromWLLocal)/this.stepWLLocal));
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
},
|
|
|
- watch: {
|
|
|
- isStep: {
|
|
|
- handler: function () {
|
|
|
- if (this.isStep) {
|
|
|
- this.stepWLLocal = (this.toWLLocal-this.fromWLLocal)/this.pointsNum;
|
|
|
- } else {
|
|
|
- this.pointsNum = Math.round((this.toWLLocal-this.fromWLLocal)/this.stepWLLocal);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // emit updated values
|
|
|
- fromWLLocal: {
|
|
|
- handler: function () {
|
|
|
- this.fromWLLocal = parseFloat(this.fromWLLocal);
|
|
|
- // if (this.fromWLLocal > this.toWLLocal) {
|
|
|
- // this.fromWLLocal = this.toWLLocal;
|
|
|
- // }
|
|
|
- this.$emit('fromWLData',this.fromWLLocal);
|
|
|
- }
|
|
|
- },
|
|
|
- toWLLocal: {
|
|
|
- handler: function () {
|
|
|
- this.toWLLocal = parseFloat(this.toWLLocal);
|
|
|
- // if (this.toWLLocal < this.fromWLLocal) {
|
|
|
- // this.toWLLocal = this.fromWLLocal;
|
|
|
- // }
|
|
|
- this.$emit('toWLData',this.toWLLocal);
|
|
|
- }
|
|
|
- },
|
|
|
- stepWLLocal: {
|
|
|
- handler: function () {
|
|
|
- this.$emit('stepWLData',this.stepWLLocal);
|
|
|
- }
|
|
|
- },
|
|
|
- // update local values
|
|
|
- fromWL: {
|
|
|
- handler: function () {
|
|
|
- this.fromWLLocal = this.fromWL;
|
|
|
- }
|
|
|
- },
|
|
|
- toWL: {
|
|
|
- handler: function () {
|
|
|
- this.toWLLocal = this.toWL;
|
|
|
- }
|
|
|
- },
|
|
|
- stepWL: {
|
|
|
- handler: function () {
|
|
|
- this.stepWLLocal = this.stepWL;
|
|
|
- }
|
|
|
- },
|
|
|
- deep: true
|
|
|
- },
|
|
|
- props: ['fromWL', 'toWL', 'stepWL', 'source_units']
|
|
|
- }
|
|
|
+ props: ['fromWL', 'toWL', 'stepWL', 'source_units']
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|