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

Side by Side Diff: samples/swarm/SwarmViews.dart

Issue 11418075: Dartifying members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixing menuelement.compact exclusion. Created 8 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 | « samples/playground/playground.html ('k') | samples/third_party/dromaeo/Dromaeo.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 // TODO(jacobr): there is a lot of dead code in this class. Checking is as is 5 // TODO(jacobr): there is a lot of dead code in this class. Checking is as is
6 // and then doing a large pass to remove functionality that doesn't make sense 6 // and then doing a large pass to remove functionality that doesn't make sense
7 // given the UI layout. 7 // given the UI layout.
8 8
9 /** 9 /**
10 * Front page of Swarm. 10 * Front page of Swarm.
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 watch(item.unread, (e) { 774 watch(item.unread, (e) {
775 // TODO(rnystrom): Would be nice to do: 775 // TODO(rnystrom): Would be nice to do:
776 // node.classes.set('story-unread', item.unread.value) 776 // node.classes.set('story-unread', item.unread.value)
777 if (item.unread.value) { 777 if (item.unread.value) {
778 node.classes.add('story-unread'); 778 node.classes.add('story-unread');
779 } else { 779 } else {
780 node.classes.remove('story-unread'); 780 node.classes.remove('story-unread');
781 } 781 }
782 }); 782 });
783 } 783 }
784 784
785 /** 785 /**
786 * Notify the view to jump to a different area if we are selecting an 786 * Notify the view to jump to a different area if we are selecting an
787 * article that is currently outside of the visible area. 787 * article that is currently outside of the visible area.
788 */ 788 */
789 void _updateViewForSelectedArticle() { 789 void _updateViewForSelectedArticle() {
790 Article selArticle = swarm.state.selectedArticle.value; 790 Article selArticle = swarm.state.selectedArticle.value;
791 if (swarm.state.hasArticleSelected) { 791 if (swarm.state.hasArticleSelected) {
792 // Ensure that the selected article is visible in the view. 792 // Ensure that the selected article is visible in the view.
793 if (!swarm.state.inMainView) { 793 if (!swarm.state.inMainView) {
794 // Story View. 794 // Story View.
795 swarm.frontView.detachedView.itemsView.showView(selArticle); 795 swarm.frontView.detachedView.itemsView.showView(selArticle);
796 } else { 796 } else {
797 if(swarm.frontView.currentSection.inCurrentView(selArticle)) { 797 if(swarm.frontView.currentSection.inCurrentView(selArticle)) {
798 // Scroll horizontally if needed. 798 // Scroll horizontally if needed.
(...skipping 10 matching lines...) Expand all
809 } 809 }
810 810
811 String getDataUriForImage(final img) { 811 String getDataUriForImage(final img) {
812 // TODO(hiltonc,jimhug) eval perf of this vs. reusing one canvas element 812 // TODO(hiltonc,jimhug) eval perf of this vs. reusing one canvas element
813 final CanvasElement canvas = new CanvasElement( 813 final CanvasElement canvas = new CanvasElement(
814 height: img.height, width: img.width); 814 height: img.height, width: img.width);
815 815
816 final CanvasRenderingContext2D ctx = canvas.getContext("2d"); 816 final CanvasRenderingContext2D ctx = canvas.getContext("2d");
817 ctx.drawImage(img, 0, 0, img.width, img.height); 817 ctx.drawImage(img, 0, 0, img.width, img.height);
818 818
819 return canvas.toDataURL("image/png"); 819 return canvas.toDataUrl("image/png");
820 } 820 }
821 821
822 /** 822 /**
823 * Update this view's selected appearance based on the currently selected 823 * Update this view's selected appearance based on the currently selected
824 * Article. 824 * Article.
825 */ 825 */
826 void _refreshSelected(curItem) { 826 void _refreshSelected(curItem) {
827 if (curItem.value == item) { 827 if (curItem.value == item) {
828 addClass('sel'); 828 addClass('sel');
829 } else { 829 } else {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 * [Feed]. 966 * [Feed].
967 */ 967 */
968 DataSourceView findView(Feed dataSource) { 968 DataSourceView findView(Feed dataSource) {
969 return dataSourceView.getSubview(dataSourceView.findIndex(dataSource)); 969 return dataSourceView.getSubview(dataSourceView.findIndex(dataSource));
970 } 970 }
971 971
972 bool inCurrentView(Article article) { 972 bool inCurrentView(Article article) {
973 return dataSourceView.findIndex(article.dataSource) != null; 973 return dataSourceView.findIndex(article.dataSource) != null;
974 } 974 }
975 } 975 }
OLDNEW
« no previous file with comments | « samples/playground/playground.html ('k') | samples/third_party/dromaeo/Dromaeo.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698