Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2667

Panel changes it's position after resize.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 7.0.2
    • Components
    • None

      if a floating,resizable panel inside a border-layout(which has north or west).
      when resize it, you will see it's left,top also be changed too.
      case here : http://zkfiddle.org/sample/1u80vmb/1-panel-position-bug

      <zk>
      <hlayout hflex="1" vflex="1">
      <borderlayout hflex="1" vflex="1">
      	<north>
      		<div height="100px" style="background:#C00000"></div>
      	</north>
      	<west>
      		<div width="50px" height="100%" style="background:#C0C000"></div>
      	</west>
      	<center>
      		<window hflex="1" vflex="1">
      			<panel left="100" top="0" border="normal" 
      				width="300px" height="200px" closable="true" maximizable="true" minimizable="true"
      				movable="true" sizable="true" floatable="true">
      				<caption label="Test Panel" />
      				<panelchildren>
      					<div hflex="1" vflex="1">
      						Please resize me. you will see my top/left position changed.
      					</div>
      				</panelchildren>
      			</panel>
      			<window border="normal" mode="overlapped" closable="true" sizable="true"
      				left="500" top="500">
      				<caption label="Test Window" />
      				<div hflex="1" vflex="1">
      						Please resize me. I am window , I am fine
      				</div>
      			</window>
      		</window>
      	</center>
      </borderlayout>
      <borderlayout hflex="1" vflex="1">
      	<center>
      		<window hflex="1" vflex="1">
      			<panel left="100" top="0" border="normal" 
      				width="300px" height="200px" closable="true" maximizable="true" minimizable="true"
      				movable="true" sizable="true" floatable="true">
      				<caption label="Test Panel" />
      				<panelchildren>
      					<div hflex="1" vflex="1">
      						Please resize me. I am just disappeared
      					</div>
      				</panelchildren>
      			</panel>
      		</window>
      	</center>
      </borderlayout>
      </hlayout>
      </zk>
      

      workaround here : http://zkfiddle.org/sample/1u80vmb/2-panel-position-bug-with-wordaround
      workaround code (there is a -1, I didn't dig into that why i need to -1).

      zk.afterLoad('zul.wnd', function () {
      	zul.wnd.Panel._endghostsizing = function (dg, origin) {
      		var el = dg.node; 
      		if (origin) {
      			//the drag element's parent is not the same as panel's
      			//so, i need to calculate the correct position by revisedOffset
      			var n = dg.control.$n();
      			var ro = zk(n).revisedOffset();
      			var rtop = el.offsetTop-(ro[1]-n.offsetTop-1);
      			var rleft = el.offsetLeft-(ro[0]-n.offsetLeft-1);
      			dg.z_szofs = {
      				top: rtop + 'px', left: rleft + 'px',
      				height: jq.px0(zk(el).revisedHeight(el.offsetHeight)),
      				width: jq.px0(zk(el).revisedWidth(el.offsetWidth))
      			};
      		}
      	}
      });
      

            Unassigned Unassigned
            dennis dennis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: