Details
-
Bug
-
Resolution: Fixed
-
Normal
-
8.6.0.1
-
Security Level: Jimmy
-
None
Description
Steps to Reproduce
run the example menupopup-direction.zul
open the menupopups to deeper levels
Current Result
the menu strangely keeps opening left/right/left/right after reaching the right screen border.
especially annoying when starting the menu from the right
Expected Result
use the screen area available before switching direction
e.g from left
or right
Debug Info
Root Cause
Workaround
commented out in the attached example:
zk.afterLoad('zul.menu', function() { var xMenupopup = {}; zk.override(zul.menu.Menupopup.prototype, xMenupopup, { open : function (ref, offset, position, opts) { if(!offset && !position) { this._reverseDir = this._parentPopup()._reverseDir || false; if(this._reverseDir) position = 'start_before'; } xMenupopup.open.call(this, ref, offset, position, opts); }, _syncPos : function () { var parentPopup = this._parentPopup(); if(parentPopup && zk(this).isOverlapped(parentPopup.$n(), 5)) { this._reverseDir = !this._reverseDir; var position = this._reverseDir ? 'start_before' : 'end_before'; zk(this).position(this.parent.$n().getBoundingClientRect(), position, {}) } }, _parentPopup : function () { return jq(this.parent).closest('@menupopup').zk.$(); } });//zk.override });//zk.afterLoad