OLD | NEW |
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 // We can't pass the currently dragging tile via dataTransfer because of | 8 // We can't pass the currently dragging tile via dataTransfer because of |
9 // http://crbug.com/31037 | 9 // http://crbug.com/31037 |
10 var currentlyDraggingTile = null; | 10 var currentlyDraggingTile = null; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 */ | 91 */ |
92 onDragStart_: function(e) { | 92 onDragStart_: function(e) { |
93 // The user may start dragging again during a previous drag's finishing | 93 // The user may start dragging again during a previous drag's finishing |
94 // animation. | 94 // animation. |
95 if (this.classList.contains('dragging')) | 95 if (this.classList.contains('dragging')) |
96 this.finalizeDrag_(); | 96 this.finalizeDrag_(); |
97 | 97 |
98 setCurrentlyDraggingTile(this); | 98 setCurrentlyDraggingTile(this); |
99 | 99 |
100 e.dataTransfer.effectAllowed = 'copyMove'; | 100 e.dataTransfer.effectAllowed = 'copyMove'; |
101 // TODO(estade): fill this in. | |
102 e.dataTransfer.setData('text/plain', 'foo'); | |
103 | 101 |
104 // The drag clone is the node we use as a representation during the drag. | 102 // The drag clone is the node we use as a representation during the drag. |
105 // It's attached to the top level document element so that it floats above | 103 // It's attached to the top level document element so that it floats above |
106 // image masks. | 104 // image masks. |
107 this.dragClone = this.cloneNode(true); | 105 this.dragClone = this.cloneNode(true); |
108 this.dragClone.style.right = ''; | 106 this.dragClone.style.right = ''; |
109 this.dragClone.classList.add('drag-representation'); | 107 this.dragClone.classList.add('drag-representation'); |
110 $('card-slider-frame').appendChild(this.dragClone); | 108 $('card-slider-frame').appendChild(this.dragClone); |
111 this.eventTracker.add(this.dragClone, 'webkitTransitionEnd', | 109 this.eventTracker.add(this.dragClone, 'webkitTransitionEnd', |
112 this.onDragCloneTransitionEnd_.bind(this)); | 110 this.onDragCloneTransitionEnd_.bind(this)); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 */ | 1007 */ |
1010 tileMoved: function(draggedTile) { | 1008 tileMoved: function(draggedTile) { |
1011 }, | 1009 }, |
1012 }; | 1010 }; |
1013 | 1011 |
1014 return { | 1012 return { |
1015 getCurrentlyDraggingTile: getCurrentlyDraggingTile, | 1013 getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
1016 TilePage: TilePage, | 1014 TilePage: TilePage, |
1017 }; | 1015 }; |
1018 }); | 1016 }); |
OLD | NEW |