Changeset 79:37ae7c70f961 for source/class
- Timestamp:
- Oct 28, 2008, 6:19:18 PM (16 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- source/class/pf
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/class/pf/Application.js
r78 r79 1 1 /* ************************************************************************ 2 2 3 Copyright: 4 5 License: 6 7 Authors: 3 Copyright: Weizmann Institute of Science 4 5 License: GPL 6 7 Authors: Evgeny Stambulchik 8 8 9 9 ************************************************************************ */ … … 16 16 ************************************************************************ */ 17 17 18 19 function NumPrint(v, prec)20 {21 var s;22 23 if (prec == null) {24 prec = 3;25 }26 27 if (v == 0.0) {28 s = "0";29 } else30 if (!isFinite(v)) {31 s = v;32 } else33 if (Math.abs(v) < 1.e6 && Math.abs(v) >= 0.1) {34 s = sprintf("%." + prec.toString() + "f", v);35 } else {36 s = sprintf("%." + prec.toString() + "e", v);37 }38 39 return s;40 }41 18 42 19 function changeN_e(ev) … … 909 886 var value = scale*this.evaluateEntityValue(entity, species); 910 887 911 rowData.push({ s_icon 912 913 914 name 915 section 916 value : {text : NumPrint(value)}888 rowData.push({ s_icon : {icon : icon, 889 iconWidth : 16, 890 iconHeight : 16 }, 891 name : {text : name }, 892 section : {text : entity.section }, 893 value : {text : pf.util.Format.numPrint(value)} 917 894 }); 918 895 } -
source/class/pf/ui/TextField.js
r72 r79 5 5 6 6 construct: function(v) { 7 this.base(arguments, NumPrint(v));7 this.base(arguments, pf.util.Format.numPrint(v)); 8 8 }, 9 9 … … 12 12 setNumValue: function(v) 13 13 { 14 this.setValue( NumPrint(v));14 this.setValue(pf.util.Format.numPrint(v)); 15 15 }, 16 16 -
source/class/pf/ui/canvas/Plotter.js
r72 r79 83 83 this.dPoint2vPoint(tracker.dp, tracker.vp); 84 84 this.vPoint2wPoint(tracker.vp, tracker.wp); 85 tracker.setLabel("X: " + NumPrint(tracker.wp.x) +86 "<br>Y: " + NumPrint(tracker.wp.y));85 tracker.setLabel("X: " + pf.util.Format.numPrint(tracker.wp.x) + 86 "<br>Y: " + pf.util.Format.numPrint(tracker.wp.y)); 87 87 tracker.setLeft(tracker.dp.x + 12); 88 88 tracker.setTop(tracker.dp.y - 12); … … 361 361 362 362 if (major_tick) { 363 this.drawStringV(vp1, NumPrint(wval, prec), halign, valign); 363 this.drawStringV(vp1, 364 pf.util.Format.numPrint(wval, prec), halign, valign); 364 365 } 365 366 }
Note: See TracChangeset
for help on using the changeset viewer.