Loading ...
Sorry, an error occurred while loading the content.

Example code

Expand Messages
  • d_adamkiewicz
    Example below - change paths to suitable -(at least on FF 1.5.0.3/Linux box) shows what I mean. When d1 and d2 dropped, they are treated as overlapped - should
    Message 1 of 3 , Dec 2, 2007
    • 0 Attachment
      Example below - change paths to suitable -(at least on FF
      1.5.0.3/Linux box) shows what
      I mean. When d1 and d2 dropped, they are treated as overlapped -
      should they?
      ---
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <style type="text/css">
      .bigbox {
      height: 200px;
      width: 200px;
      background: #cdcdff;
      }
      .box {
      height: 100px;
      width: 100px;
      background: #f00;
      }
      </style>
      <?php include_once("path_begin.php");?>
      <script type="text/javascript" src=<?=
      "\"$path_begin/libs/yui/build/yahoo/yahoo.js\"" ?>></script>
      <script type="text/javascript" src=<?=
      "\"$path_begin/libs/yui/build/dom/dom.js\"" ?>></script>
      <script type="text/javascript" src=<?=
      "\"$path_begin/libs/yui/build/event/event.js\"" ?>></script>
      <script type="text/javascript" src=<?=
      "\"$path_begin/libs/yui/build/dragdrop/dragdrop-debug.js\"" ?>></script>
      <script type="text/javascript" src=<?=
      "\"$path_begin/libs/yui/build/logger/logger.js\"" ?>></script>
      </head>
      <body>
      <div style="width: 300px; float: left">
      <div id="d1" class="box"></div><br />
      <div id="d2" class="box" style="background: #000;"></div><br />
      <div id="dt" class="bigbox"></div>
      </div>
      <div style="width: 400px; float: left">
      <div id="log"></div>
      </div>
      <script type="text/javascript">
      new YAHOO.widget.LogReader("log");
      YAHOO.util.DragDropMgr.mode = YAHOO.util.DragDropMgr.INTERSECT;
      new YAHOO.util.DDTarget("dt");
      var r = YAHOO.util.Dom.getRegion("dt");
      YAHOO.log(r, "info");
      var dd1 = new YAHOO.util.DD("d1");
      dd1.yTicks = [r.top, r.top + 100];
      dd1.xTicks = [r.left, r.left + 100];
      var dd2 = new YAHOO.util.DD("d2");
      dd2.yTicks = [r.top, r.top + 100];;
      dd2.xTicks = [r.left, r.left + 100];
      dd1.onDragDrop = function(e, elArray) {
      YAHOO.log("d1: " + elArray.toString(), "info");
      };
      dd2.onDragDrop = function(e, elArray) {
      YAHOO.log("d2: " + elArray.toString(), "info");
      };
      </script>
      </body>
      </html>
    • d_adamkiewicz
      ... YAHOO.util.Region.prototype.intersect = function(region) { var t = Math.max( this.top, region.top ); var r = Math.min( this.right, region.right );
      Message 2 of 3 , Dec 3, 2007
      • 0 Attachment
        ... and it can be changed very easily
        ---
        YAHOO.util.Region.prototype.intersect = function(region) {
        var t = Math.max( this.top, region.top );
        var r = Math.min( this.right, region.right );
        var b = Math.min( this.bottom, region.bottom );
        var l = Math.max( this.left, region.left );

        if (b >= t && r >= l) {// cause here
        return new YAHOO.util.Region(t, r, b, l);
        } else {
        return null;
        }
        };
      Your message has been successfully submitted and would be delivered to recipients shortly.