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

Side by Side Diff: chrome/browser/resources/ntp4/tile_page.js

Issue 6992009: ntp4: Fix a couple small visual glitches with tile dragging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whitespace Created 9 years, 7 months 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 | « chrome/browser/resources/ntp4/new_tab.css ('k') | no next file » | 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 Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('ntp4', function() { 5 cr.define('ntp4', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a new Tileobject. Tiles wrap content on a TilePage, providing 9 * Creates a new Tileobject. Tiles wrap content on a TilePage, providing
10 * some styling and drag functionality. 10 * some styling and drag functionality.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 this.onDragMove_(e); 93 this.onDragMove_(e);
94 }, 94 },
95 95
96 /** 96 /**
97 * The handler for drag events fired on |this|. 97 * The handler for drag events fired on |this|.
98 * @param {Event} e The event for the drag. 98 * @param {Event} e The event for the drag.
99 * @private 99 * @private
100 */ 100 */
101 onDragMove_: function(e) { 101 onDragMove_: function(e) {
102 if (e.view != window || (e.pageX == 0 && e.pageY == 0)) {
103 // attribute hidden seems to be overridden by display.
104 this.dragClone.classList.add('hidden');
105 return;
106 }
107
108 this.dragClone.classList.remove('hidden');
102 this.dragClone.style.left = (e.pageX - this.dragOffsetX) + 'px'; 109 this.dragClone.style.left = (e.pageX - this.dragOffsetX) + 'px';
103 this.dragClone.style.top = (e.pageY - this.dragOffsetY) + 'px'; 110 this.dragClone.style.top = (e.pageY - this.dragOffsetY) + 'px';
104 }, 111 },
105 112
106 /** 113 /**
107 * The handler for dragend events fired on |this|. 114 * The handler for dragend events fired on |this|.
108 * @param {Event} e The event for the drag. 115 * @param {Event} e The event for the drag.
109 * @private 116 * @private
110 */ 117 */
111 onDragEnd_: function(e) { 118 onDragEnd_: function(e) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 hasDoppleganger: function() { 175 hasDoppleganger: function() {
169 return !!this.doppleganger_; 176 return !!this.doppleganger_;
170 }, 177 },
171 178
172 /** 179 /**
173 * Called when the drag representation node is done migrating to its final 180 * Called when the drag representation node is done migrating to its final
174 * resting spot. 181 * resting spot.
175 * @param {Event} e The transition end event. 182 * @param {Event} e The transition end event.
176 */ 183 */
177 onDragCloneTransitionEnd_: function(e) { 184 onDragCloneTransitionEnd_: function(e) {
178 var clone = this.dragClone; 185 if (e.propertyName == 'left') {
179 this.dragClone = null; 186 var clone = this.dragClone;
187 this.dragClone = null;
180 188
181 clone.parentNode.removeChild(clone); 189 clone.parentNode.removeChild(clone);
182 this.eventTracker.remove(clone, 'webkitTransitionEnd'); 190 this.eventTracker.remove(clone, 'webkitTransitionEnd');
183 this.classList.remove('dragging'); 191 this.classList.remove('dragging');
192 }
184 } 193 }
185 }; 194 };
186 195
187 /** 196 /**
188 * Gives the proportion of the row width that is devoted to a single icon. 197 * Gives the proportion of the row width that is devoted to a single icon.
189 * @param {number} rowTileCount The number of tiles in a row. 198 * @param {number} rowTileCount The number of tiles in a row.
190 * @return {number} The ratio between icon width and row width. 199 * @return {number} The ratio between icon width and row width.
191 */ 200 */
192 function tileWidthFraction(rowTileCount) { 201 function tileWidthFraction(rowTileCount) {
193 return rowTileCount + 202 return rowTileCount +
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 // This should not get called unless there is a non-default 831 // This should not get called unless there is a non-default
823 // implementation. 832 // implementation.
824 assert(false); 833 assert(false);
825 }, 834 },
826 }; 835 };
827 836
828 return { 837 return {
829 TilePage: TilePage, 838 TilePage: TilePage,
830 }; 839 };
831 }); 840 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698