diff js-lib/buy3.js @ 98:388344355ebf laserkard

figured out how to scale down main display
author Robert McIntyre <rlm@mit.edu>
date Tue, 27 Jul 2010 05:14:22 -0400
parents 8a3615df4c18
children 9649b14f3b38
line wrap: on
line diff
     1.1 --- a/js-lib/buy3.js	Tue Jul 27 03:51:01 2010 -0400
     1.2 +++ b/js-lib/buy3.js	Tue Jul 27 05:14:22 2010 -0400
     1.3 @@ -1,24 +1,3 @@
     1.4 -// Cards = (function (){
     1.5 -
     1.6 -    
     1.7 -//     (function (info paper){
     1.8 -// 	info.name
     1.9 -// 	info.occupation
    1.10 -// 	info.email
    1.11 -// 	info.phone
    1.12 -     
    1.13 -     
    1.14 -
    1.15 -
    1.16 -
    1.17 -
    1.18 -// });
    1.19 -
    1.20 -
    1.21 -
    1.22 -    
    1.23 -
    1.24 -
    1.25  
    1.26  Buy = (function (){ 
    1.27  
    1.28 @@ -27,7 +6,7 @@
    1.29      var Cards = 
    1.30  	{"bold" : {
    1.31  	    "name" :(function (text, display){
    1.32 -		return display.print(10,10,text,helvetica, 25).attr(
    1.33 +		return display.print(10,20,text,helvetica, 25).attr(
    1.34  		    {"fill" : "#0F0"});}),
    1.35  	    "email" : (function (text, paper){
    1.36  		return paper.print(50,50,text,helvetica_I,40).attr(
    1.37 @@ -90,12 +69,14 @@
    1.38      
    1.39      var display;
    1.40      var color;
    1.41 -    var style;
    1.42 +    var style = {};
    1.43      var helvetica;
    1.44      var helvetica_I;
    1.45  
    1.46      var state_map = {
    1.47 -    	green : {ref : null, 
    1.48 +    	bold  : {ref : null},
    1.49 +	
    1.50 +	green : {ref : null, 
    1.51      		 offState : {"fill" : "#030", "scale": 1} , 
    1.52      		 onState :  {"fill" : "#0F0", "scale": 1}},
    1.53      	red  : {ref : null,
    1.54 @@ -143,23 +124,39 @@
    1.55  		if ($(this).val() == $(this).attr('title')){
    1.56  		    $(this).val('');}})})});
    1.57  
    1.58 +    
    1.59  
    1.60 -    
    1.61 +
    1.62 +    var style_init = (function (){
    1.63 +	state_map["bold"] = style.bold.set();
    1.64 +	//var yyy = Cards.bold.name("Ru", style.bold);
    1.65 +	
    1.66 +	//for each (var item in yyy.items) {item.scale(0.5, 0.5);}
    1.67 +//	for (var letter in yyy) {
    1.68 +//		letter.scale(0.5,0.5);}
    1.69 +	
    1.70 +	state_map["bold"].push(Cards.bold.name("Robert", style.bold));
    1.71 +	state_map["bold"].attr({"fill" : "red"}); //.scale(0.5, 0.5, 0, 0);
    1.72 +	state_map["bold"].scale(0.03, 0.03, 0 , 0);
    1.73 +
    1.74 +    });
    1.75 +
    1.76      
    1.77  
    1.78  
    1.79      var init = (function () {
    1.80  	display = Raphael("card-display", 340 ,215);
    1.81  	color = Raphael("color-select", 300, 100);
    1.82 -	style = Raphael("style-select", 200, 70);
    1.83 +	style.bold = Raphael("bold", 100, 100);
    1.84 +	//style = Raphael("style-select", 200, 70);
    1.85  	helvetica = display.getFont('HelveticaNeue', 700);
    1.86  	helvetica_I = display.getFont('HelveticaNeue', 800);
    1.87 -
    1.88  	color_select_init();
    1.89  	display_init();
    1.90  	card_init();	
    1.91  	text_entry_init();
    1.92  	key_handling();
    1.93 +	style_init();
    1.94  	update();
    1.95      });
    1.96