Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: client/samples/total/src/ColorPicker.dart

Issue 8835006: New version of dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typos Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/samples/sunflower/Sunflower.dart ('k') | client/samples/total/src/ContextMenu.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 /** 4 /**
5 * A graphical picker for a set of predefined colors. 5 * A graphical picker for a set of predefined colors.
6 */ 6 */
7 class ColorPicker extends Picker { 7 class ColorPicker extends Picker {
8 8
9 List<String> _colors; 9 List<String> _colors;
10 int _columns; 10 int _columns;
(...skipping 18 matching lines...) Expand all
29 root.classes.add("fadeOut"); 29 root.classes.add("fadeOut");
30 30
31 Document doc = root.document; 31 Document doc = root.document;
32 32
33 int idx = 0; 33 int idx = 0;
34 for (int j = 0; j < _rows; j++) { 34 for (int j = 0; j < _rows; j++) {
35 int y = _margin + j * (_width + _margin); 35 int y = _margin + j * (_width + _margin);
36 for (int i = 0; i < _columns; i++) { 36 for (int i = 0; i < _columns; i++) {
37 int x = _margin + i * (_width + _margin); 37 int x = _margin + i * (_width + _margin);
38 38
39 DivElement div = doc.createElement("div"); 39 DivElement div = new Element.tag("div");
40 div.attributes["class"] = "color-picker-item"; 40 div.attributes["class"] = "color-picker-item";
41 div.id = "color-picker-${idx}"; 41 div.id = "color-picker-${idx}";
42 div.style.setProperty("position", "absolute"); 42 div.style.setProperty("position", "absolute");
43 div.style.setProperty("left", HtmlUtils.toPx(x)); 43 div.style.setProperty("left", HtmlUtils.toPx(x));
44 div.style.setProperty("top", HtmlUtils.toPx(y)); 44 div.style.setProperty("top", HtmlUtils.toPx(y));
45 div.style.setProperty("width", HtmlUtils.toPx(_width)); 45 div.style.setProperty("width", HtmlUtils.toPx(_width));
46 div.style.setProperty("height", HtmlUtils.toPx(_width)); 46 div.style.setProperty("height", HtmlUtils.toPx(_width));
47 if (idx == 0) { 47 if (idx == 0) {
48 div.style.setProperty("background", "url(/img/inner-menu-bg.png)"); 48 div.style.setProperty("background", "url(/img/inner-menu-bg.png)");
49 } else { 49 } else {
50 div.style.setProperty("background-color", _colors[idx]); 50 div.style.setProperty("background-color", _colors[idx]);
51 } 51 }
52 div.on.click.add(_clickHandler); 52 div.on.click.add(_clickHandler);
53 53
54 root.nodes.add(div); 54 root.nodes.add(div);
55 idx++; 55 idx++;
56 } 56 }
57 } 57 }
58 } 58 }
59 } 59 }
OLDNEW
« no previous file with comments | « client/samples/sunflower/Sunflower.dart ('k') | client/samples/total/src/ContextMenu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698