Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

j.namespacebrowser.view draws pop-out patcher with offset when nested #1018

Open
evanmtp opened this issue Mar 13, 2017 · 1 comment
Open

Comments

@evanmtp
Copy link

evanmtp commented Mar 13, 2017

Under some circumstaces, j.namespacebrowser.view will incorrectly position the pop-out browser patcher.

When j.namespacebrowser.view is instantiated inside of a panel within a view, the pop-out browser will appear at a location determined by the position of the view in the main patch. In the following screenshot, clicking on the j.namespacebrowser.view menu widget next to Input in the panel has caused the browser pop-out window to appear over the view in the main patch.

screen shot 2017-03-13 at 6 45 09 pm

In the next screenshot, the main patcher window has been moved, and menu widget in the panel has been clicked again. Note that the pop-out panel has traveled with the view in the main patcher.

screen shot 2017-03-13 at 6 48 31 pm

Please see the following patch for a demonstration.


----------begin_max5_patcher----------
815.3oc6VsjaaCCDcs8oX.W0h5XXEW+IcWWlUcSA5hlfBJow1LghTfjxeZPN
.8VTfdS5QomjN7ibUPhyuFftoajMmgZ97dugTW0uGKWuEsL3cvmgd8tpeudA
SdC8Rq6wp3aKjbaXar7ZtqXEZXChN4Jk1wcBsJ3VoUXqq0BbyZgUjKjB2Nu6
rjG8hEVzES6ngiF3e.mmbJ0EWhkkF9RagQKk9sMJ4qPJJtzsxnaVtpqcTwyk
3pa+BQGqusi7kU5R7FVzlRpu5XIzpB0xuXvhT0lcxDe8NdT74n1E6qdUSkPI
Qmsa+JJCfiN+hiNoEcT7pP5YWLz+WaMu.yM5MVzLzibCIXmJ.1ehqtw0F3ia
AxfI2tZLVdL1.hh3pkL3b+Nttee+iAORxsPWUgp84zgaCsM6C0nBbqP3MPMW
gRfqJAmYGD3CBg.cz+u91O.JBMPdiyQ1zKBlOicpptwcFCNPyBCgSUVGxK8u
ButF4FeXUTE.N8cFaQLkgBZP7u55iHDARQFRR0T7r.2QENDEezlsBurkxryB
jnKHh8MBIVPpeEVnDcng3SrDx2kRQ7sZ6rJeri8vO+d6rwP3iD1ToW6aA+tV
ost8UyFgpTuAzlfqtQ.ZCfukWiFwBeRE1gsDhjJkBciJvJyNrJc5zfvLaRTe
lMOrZzCpSstcxnnjcak676VJN5ETm8oUDteHIBwGXUNcx.wFBkUTh.GBdjZd
zHYXOD9J5ANnK7956WkXcBorqVwu4BswCqzuzoCBE2gOc1HaRGxHa5jWBxXx
+dxnT3aQ4ttrBQ.I37lX88MR9jf4oODLONgxAI+7Y+Uf73WNP9+Wa1YF3soQ
gQSdH5gaVl95DVbPlse+c3o21Bc0FzRR4.t1I6iSibyObxauLtywE26EvYG7
B3m0EuJbC0HGPbfkB5hK5lIzeuf+mRtiGNYiP4aM2lZAOOISG+0tmEZkaAMJ
+3XqimEQpwYgUG2Au7AxJ9ZHPYjim8H1rtk1dV38FAW9L9xmaB9gpkQ..cUp
MAlAzmfnKzl8mZynhNtbbXoA8iew8GsvMDD4H7owDKvsSiZNlGkMpFQng66y
708+MPeMKrF
-----------end_max5_patcher-----------

The issue is based in j.get_onscreen_position.js, which is being used to get the position of the menu widget, but I'm afraid my JavaScript chops aren't up to offering a fix.

@evanmtp
Copy link
Author

evanmtp commented Mar 14, 2017

Update: the issue seems to be that some of the code in j.get_onscreen_position.js recursively drills down to the top-level patcher and uses its coordinates to provide the window offset (containerposition) for positioning the pop-out browser window. This is fine for instances where j.namespacebrowser.view is instantiated directly in a patch or in the main GUI of a view, but it causes problems if j.namespacebrowser.view is in a panel - effectively, the JS skips over the panel window and just returns the main window’s coordinates. I modified the JS by removing the code related to containerposition. Inside j.namespacebrowser.view, I also changed the loadmess going into vexpr (which provides an horizontal and vertical offset to account for the patcher toolbars) from 52 34 to 18 0. This gives the correct alignment and seems to work whether j.namespacebrowser.view is loaded in a patcher, a view’s main GUI or a view’s panel.

Here's a zip containing a demo patch, a demo model and view with panel, and modified versions of j.namespacebrowser.view and j.get_onscreen_position.js :

j.namespacebrowser_modified.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant