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

INTERSECT mode

Expand Messages
  • d_adamkiewicz
    Hi If in INTERSECT mode one drag and drop object is dropped next to another, say: bottom edge of first one is at 202px, while top edge of second is also at
    Message 1 of 3 , Dec 2, 2007
    • 0 Attachment
      Hi

      If in INTERSECT mode one drag and drop object is dropped next to
      another, say:
      bottom edge of first one is at 202px, while top edge of second is also
      at 202px,
      (case 1)
      right: 442 left: 392 top: 152 bottom: 202
      right: 442 left: 392 top: 202 bottom: 252

      -so they don't share any space but are ajacent to each other, then for

      dd.onDragDrop = function(e, elArray){};

      should 'elArray' contain that another object?

      And in case of
      (case 2)
      right: 442 left: 392 top: 152 bottom: 202
      right: 492 left: 442 top: 202 bottom: 252

      - left bottom corner of one object is next to top right corner of another

      should 'elArray' contain that another object?

      Or only DD objects that share space with dropped one
      should be set in 'elArray' array?

      I hope this is understandable:) English is not my first language.

      Regards
      Darek
    • 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 2 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 3 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.