Mercurial > laserkard
comparison 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 |
comparison
equal
deleted
inserted
replaced
97:8a3615df4c18 | 98:388344355ebf |
---|---|
1 // Cards = (function (){ | |
2 | |
3 | |
4 // (function (info paper){ | |
5 // info.name | |
6 // info.occupation | |
7 // info.email | |
8 // info.phone | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 // }); | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | 1 |
23 Buy = (function (){ | 2 Buy = (function (){ |
24 | 3 |
25 //Cards drawing functions: | 4 //Cards drawing functions: |
26 | 5 |
27 var Cards = | 6 var Cards = |
28 {"bold" : { | 7 {"bold" : { |
29 "name" :(function (text, display){ | 8 "name" :(function (text, display){ |
30 return display.print(10,10,text,helvetica, 25).attr( | 9 return display.print(10,20,text,helvetica, 25).attr( |
31 {"fill" : "#0F0"});}), | 10 {"fill" : "#0F0"});}), |
32 "email" : (function (text, paper){ | 11 "email" : (function (text, paper){ |
33 return paper.print(50,50,text,helvetica_I,40).attr( | 12 return paper.print(50,50,text,helvetica_I,40).attr( |
34 {"fill" : "red"});})} | 13 {"fill" : "red"});})} |
35 | 14 |
88 company : "LaserKard LLC." | 67 company : "LaserKard LLC." |
89 }; | 68 }; |
90 | 69 |
91 var display; | 70 var display; |
92 var color; | 71 var color; |
93 var style; | 72 var style = {}; |
94 var helvetica; | 73 var helvetica; |
95 var helvetica_I; | 74 var helvetica_I; |
96 | 75 |
97 var state_map = { | 76 var state_map = { |
98 green : {ref : null, | 77 bold : {ref : null}, |
78 | |
79 green : {ref : null, | |
99 offState : {"fill" : "#030", "scale": 1} , | 80 offState : {"fill" : "#030", "scale": 1} , |
100 onState : {"fill" : "#0F0", "scale": 1}}, | 81 onState : {"fill" : "#0F0", "scale": 1}}, |
101 red : {ref : null, | 82 red : {ref : null, |
102 offState: {"fill" : "#300", "scale" : 1}, | 83 offState: {"fill" : "#300", "scale" : 1}, |
103 onState : {"fill" : "#F00" ,"scale" : 1}}, | 84 onState : {"fill" : "#F00" ,"scale" : 1}}, |
141 $('form').submit(function() { | 122 $('form').submit(function() { |
142 $(this).find('input[type=text][title!=""]').each(function() { | 123 $(this).find('input[type=text][title!=""]').each(function() { |
143 if ($(this).val() == $(this).attr('title')){ | 124 if ($(this).val() == $(this).attr('title')){ |
144 $(this).val('');}})})}); | 125 $(this).val('');}})})}); |
145 | 126 |
146 | 127 |
147 | 128 |
129 | |
130 var style_init = (function (){ | |
131 state_map["bold"] = style.bold.set(); | |
132 //var yyy = Cards.bold.name("Ru", style.bold); | |
133 | |
134 //for each (var item in yyy.items) {item.scale(0.5, 0.5);} | |
135 // for (var letter in yyy) { | |
136 // letter.scale(0.5,0.5);} | |
137 | |
138 state_map["bold"].push(Cards.bold.name("Robert", style.bold)); | |
139 state_map["bold"].attr({"fill" : "red"}); //.scale(0.5, 0.5, 0, 0); | |
140 state_map["bold"].scale(0.03, 0.03, 0 , 0); | |
141 | |
142 }); | |
143 | |
148 | 144 |
149 | 145 |
150 | 146 |
151 var init = (function () { | 147 var init = (function () { |
152 display = Raphael("card-display", 340 ,215); | 148 display = Raphael("card-display", 340 ,215); |
153 color = Raphael("color-select", 300, 100); | 149 color = Raphael("color-select", 300, 100); |
154 style = Raphael("style-select", 200, 70); | 150 style.bold = Raphael("bold", 100, 100); |
151 //style = Raphael("style-select", 200, 70); | |
155 helvetica = display.getFont('HelveticaNeue', 700); | 152 helvetica = display.getFont('HelveticaNeue', 700); |
156 helvetica_I = display.getFont('HelveticaNeue', 800); | 153 helvetica_I = display.getFont('HelveticaNeue', 800); |
157 | |
158 color_select_init(); | 154 color_select_init(); |
159 display_init(); | 155 display_init(); |
160 card_init(); | 156 card_init(); |
161 text_entry_init(); | 157 text_entry_init(); |
162 key_handling(); | 158 key_handling(); |
159 style_init(); | |
163 update(); | 160 update(); |
164 }); | 161 }); |
165 | 162 |
166 | 163 |
167 //Update Functions | 164 //Update Functions |