Skip to content

Commit e3e3c45

Browse files
committed
don't spam user if span wasnt changed and its -vs
1 parent fc5c45d commit e3e3c45

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

smith_chart/js/smith_tool.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var resolution = 100;// 100; //number of points per arc
33
var span_resolution = 20;
44
var precision = 3;
5-
5+
var spanChanged = false;
66

77
//code to save the state to jsonBin - cool! (and free)
88
var toastElList = [].slice.call(document.querySelectorAll('.toast'))
@@ -228,6 +228,7 @@ function updateFromOldState() {
228228

229229
function updateFromDom() {
230230
schematic[0].freq = Number(domFreq.value);
231+
spanChanged = !(schematic[0].span == Number(domSpan.value))
231232
schematic[0].span = Number(domSpan.value)
232233
zo = Number(domZo.value);
233234
schematic[0].zo = Number(domZo.value);
@@ -478,12 +479,12 @@ function update_smith_chart() {
478479
freq = schematic[0].freq * schematic[0].freq_unit.multiplier;
479480
span_freq = schematic[0].span * schematic[0].span_unit.multiplier;
480481
//console.log(schematic[0].freq * schematic[0].freq_unit.multiplier,schematic[0].span * schematic[0].span_unit.multiplier)
481-
if (freq < span_freq) {
482+
if ((freq < span_freq) && spanChanged) {
482483
swal({
483484
type: 'error',
484485
title: 'Oops...',
485-
text: 'Span is larger than frequency, this will result in -ve frequencies and is not allowed..."',
486-
footer: '<a href>Reduce your span frequency</a>'
486+
text: 'Span is larger than frequency, this will result in -ve frequencies and likely you did not mean this',
487+
footer: 'Reduce your span frequency'
487488
})
488489
}
489490

0 commit comments

Comments
 (0)