Changeset 79:37ae7c70f961


Ignore:
Timestamp:
Oct 28, 2008, 6:19:18 PM (16 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

sprintf moved to pf.Util.Format.

Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • config.json

    r77 r79  
    4545      "copy-files" :
    4646      {
    47         "files" : ["index.html", "pf.html", "sprintf.js", "wz_jsgraphics.js",
    48                    "entities.js"],
     47        "files" : ["index.html", "pf.html", "wz_jsgraphics.js", "entities.js"],
    4948        "target" : "${BUILD_PATH}"
    5049      }
  • source/class/pf/Application.js

    r78 r79  
    11/* ************************************************************************
    22
    3    Copyright:
    4 
    5    License:
    6 
    7    Authors:
     3   Copyright: Weizmann Institute of Science
     4
     5   License: GPL
     6
     7   Authors: Evgeny Stambulchik
    88
    99************************************************************************ */
     
    1616************************************************************************ */
    1717
    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     } else
    30     if (!isFinite(v)) {
    31         s = v;
    32     } else
    33     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 }
    4118
    4219function changeN_e(ev)
     
    909886                var value = scale*this.evaluateEntityValue(entity, species);
    910887
    911                 rowData.push({ s_icon   : {icon       : icon,
    912                                            iconWidth  : 16,
    913                                            iconHeight : 16             },
    914                                name     : {text       : name           },
    915                                section  : {text       : entity.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)}
    917894                             });
    918895            }
  • source/class/pf/ui/TextField.js

    r72 r79  
    55   
    66    construct: function(v) {
    7         this.base(arguments, NumPrint(v));
     7        this.base(arguments, pf.util.Format.numPrint(v));
    88    },
    99   
     
    1212        setNumValue: function(v)
    1313        {
    14             this.setValue(NumPrint(v));
     14            this.setValue(pf.util.Format.numPrint(v));
    1515        },
    1616
  • source/class/pf/ui/canvas/Plotter.js

    r72 r79  
    8383                this.dPoint2vPoint(tracker.dp, tracker.vp);
    8484                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));
    8787                tracker.setLeft(tracker.dp.x + 12);
    8888                tracker.setTop(tracker.dp.y - 12);
     
    361361               
    362362                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);
    364365                }
    365366            }
  • source/pf.html

    r72 r79  
    44    <title>Plasma Formulary Interactive</title>
    55    <script type="text/javascript" src="script/pf.js"></script>
    6     <script type="text/javascript" src="sprintf.js"></script>
    76    <script type="text/javascript" src="wz_jsgraphics.js"></script>
    87    <script type="text/javascript" src="entities.js"></script>
Note: See TracChangeset for help on using the changeset viewer.