Avatar.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // wrapped by build app
  2. define("dojox/layout/dnd/Avatar", ["dijit","dojo","dojox","dojo/require!dojo/dnd/Avatar,dojo/dnd/common"], function(dijit,dojo,dojox){
  3. dojo.provide("dojox.layout.dnd.Avatar");
  4. dojo.require("dojo.dnd.Avatar");
  5. dojo.require("dojo.dnd.common");
  6. dojo.declare("dojox.layout.dnd.Avatar", dojo.dnd.Avatar, {
  7. // summary:
  8. // An Object, which represents the object being moved in a GridContainer
  9. constructor: function(manager, opacity){
  10. this.opacity = opacity || 0.9;
  11. },
  12. construct: function(){
  13. // summary:
  14. // A constructor function. it is separate so it can be (dynamically)
  15. // overwritten in case of need.
  16. var source = this.manager.source,
  17. node = source.creator ?
  18. // create an avatar representation of the node
  19. source._normalizedCreator(source.getItem(this.manager.nodes[0].id).data, "avatar").node :
  20. // or just clone the node and hope it works
  21. this.manager.nodes[0].cloneNode(true)
  22. ;
  23. dojo.addClass(node, "dojoDndAvatar");
  24. node.id = dojo.dnd.getUniqueId();
  25. node.style.position = "absolute";
  26. node.style.zIndex = 1999;
  27. node.style.margin = "0px"
  28. node.style.width = dojo.marginBox(source.node).w + "px"
  29. // add contructor object params to define it
  30. dojo.style(node, "opacity", this.opacity);
  31. this.node = node;
  32. },
  33. update: function(){
  34. // summary: Updates the avatar to reflect the current DnD state.
  35. dojo.toggleClass(this.node, "dojoDndAvatarCanDrop", this.manager.canDropFlag);
  36. },
  37. _generateText: function(){ /* nada. */ }
  38. });
  39. });