| 1 |
// Copyright 2006 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Single Element Drag and Drop. |
| 17 |
* |
| 18 |
* Drag and drop implementation for sources/targets consisting of a single |
| 19 |
* element. |
| 20 |
* |
| 21 |
* @author [email protected] (Emil A Eklund) |
| 22 |
* @see ../demos/dragdrop.html |
| 23 |
*/ |
| 24 |
|
| 25 |
goog.provide('goog.fx.DragDrop'); |
| 26 |
|
| 27 |
goog.require('goog.fx.AbstractDragDrop'); |
| 28 |
goog.require('goog.fx.DragDropItem'); |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
/** |
| 33 |
* Drag/drop implementation for creating drag sources/drop targets consisting of |
| 34 |
* a single HTML Element. |
| 35 |
* |
| 36 |
* @param {Element|string} element Dom Node, or string representation of node |
| 37 |
* id, to be used as drag source/drop target. |
| 38 |
* @param {Object=} opt_data Data associated with the source/target. |
| 39 |
* @throws Error If no element argument is provided or if the type is invalid |
| 40 |
* @extends {goog.fx.AbstractDragDrop} |
| 41 |
* @constructor |
| 42 |
* @struct |
| 43 |
*/ |
| 44 |
goog.fx.DragDrop = function(element, opt_data) { |
| 45 |
goog.fx.AbstractDragDrop.call(this); |
| 46 |
|
| 47 |
var item = new goog.fx.DragDropItem(element, opt_data); |
| 48 |
item.setParent(this); |
| 49 |
this.items_.push(item); |
| 50 |
}; |
| 51 |
goog.inherits(goog.fx.DragDrop, goog.fx.AbstractDragDrop); |