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

Limit DD resize

Expand Messages
  • varnit
    I am looking at the DD resizable panel example http://developer.yahoo.com/yui/examples/dragdrop/dd-resize_clean.html and I can t figure out how to limit the
    Message 1 of 3 , Jan 31, 2008
    • 0 Attachment
      I am looking at the DD resizable panel example
      http://developer.yahoo.com/yui/examples/dragdrop/dd-resize_clean.html
      and I can't figure out how to limit the panel from being resized to a
      certain size. For example I don't want my panel to become any smaller
      than 100x100 or any larger than 300x300. How can this be achieved?
    • Jing Ceawlin
      That s easy. In onDrag function, change these two lines: var newWidth = Math.max(this.startWidth + offsetX, 10); var newHeight = Math.max(this.startHeight +
      Message 2 of 3 , Jan 31, 2008
      • 0 Attachment
        That's easy. In onDrag function, change these two lines:
                var newWidth = Math.max(this.startWidth + offsetX, 10);
                var newHeight = Math.max(this.startHeight + offsetY, 10);

        to

                var newWidth = Math.min(Math.max(this.startWidth + offsetX, 100), 300);
                var newHeight = Math.min(Math.max(this.startHeight + offsetY, 100), 300);

        On Feb 1, 2008 10:06 AM, varnit <varnit@...> wrote:

        I am looking at the DD resizable panel example
        http://developer.yahoo.com/yui/examples/dragdrop/dd-resize_clean.html
        and I can't figure out how to limit the panel from being resized to a
        certain size. For example I don't want my panel to become any smaller
        than 100x100 or any larger than 300x300. How can this be achieved?


      • Varnit Khanna
        Thanks Jing, you rock! -varnit ... From: Jing Ceawlin To: ydn-javascript@yahoogroups.com Sent: Thursday, January 31, 2008 9:39:59 PM
        Message 3 of 3 , Jan 31, 2008
        • 0 Attachment
          Thanks Jing, you rock!

          -varnit

          ----- Original Message ----
          From: Jing Ceawlin <zjply4000@...>
          To: ydn-javascript@yahoogroups.com
          Sent: Thursday, January 31, 2008 9:39:59 PM
          Subject: Re: [ydn-javascript] Limit DD resize

          That's easy. In onDrag function, change these two lines:
                  var newWidth = Math.max(this. startWidth + offsetX, 10);
                  var newHeight = Math.max(this. startHeight + offsetY, 10);

          to

                  var newWidth = Math.min(Math. max(this. startWidth + offsetX, 100), 300);
                  var newHeight = Math.min(Math. max(this. startHeight + offsetY, 100), 300);

          On Feb 1, 2008 10:06 AM, varnit <varnit@yahoo. com> wrote:

          I am looking at the DD resizable panel example
          http://developer. yahoo.com/ yui/examples/ dragdrop/ dd-resize_ clean.html
          and I can't figure out how to limit the panel from being resized to a
          certain size. For example I don't want my panel to become any smaller
          than 100x100 or any larger than 300x300. How can this be achieved?



        Your message has been successfully submitted and would be delivered to recipients shortly.