Zoom in standalone

Jake Exkorn's icon

Hi everyone,

I am building a standalone, and I am wondering how I can create a zoom feature to zoom in and out from within the standalone. If you know how to do this, please let me know how I can accomplish this.

Best,
Jake

Source Audio's icon

simple - but not really ideal way

better try Pedro Santos patch
https://cycling74.com/forums/how-to-scale-a-ui-acording-to-window-size

Jake Exkorn's icon

Thank you for the information, Source Audio! Zoomfactor and the Pedro Santos patch are definitely helpful. If I were to include the Pedro Santos patch in some of my patches, is there a protocol for citing the work?

My next step will be figuring out how to track scrolling and use that as input for zooming in and out. My goal is to set up a mechanism similar to how zooming works in Max. I would like to have command + scroll up to zoom out from the mouse location and have command + scroll down to zoom in towards the mouse location. I figure that I could use [modifiers] to track the usage of command, [mousestate] to track the mouse location, use [js] to implement this.patcher.wind.scrollto(x, y) – where x and y are the mousestate coordinates –, and use zoomfactor to control the zooming.

In this post, they mention that [ol.mousewheel] does scroll tracking, but I haven't been able to find that object anywhere to download. I also have tried [hi] but haven't been able to get output after turning polling on and setting the device as every device available according to the menu message. If you know of a way to track scrolling movements, please let me know.

Thank you again for all of the help. I am grateful.

Best,
Jake

Source Audio's icon

You can ask mr Santos about using his code...
If you are on Windows OS, you can't use mouse and keyboard with hi objects - OS blocks that.
On Mac, hi reports mouse wheel delta allright, you only need to tame output a bit.
If you anyway want to use java, you might try to listen to mousewheel events in java ?

Jake Exkorn's icon

Thank you, Source Audio. I will ask Pedro Santos about using his code, and I will try to use javascript for the scroll tracking.
I am using a mac. In the help patch for [hi], I clicked on Apple Internal Keyboard / Trackpad and then poll 10 message. Then I used two fingers to scroll up and down using the trackpad. I followed this same process for trackpad 2 - 5. Then I tried using my M720 Triathlon mousewheel. I received no output, but the console did say that [hi] was focussing on the devices that I chose from the umenu. Do you know if I need to do something else to receive output? I attached a screen shot of the console.

Source Audio's icon

I don't use macbook trackpad for anything else than pointer
just like old simple mouse. Never liked all that gimmicks.
and disable them in system preferences.

For normal mouse with wheel, you select it from the menu,
activate polling and try to route individual values.
On my standard USB-PS/2 mouse, mousewheel gets
out with ID 8 prepended


Jake Exkorn's icon

Thank you for sharing your experience with using [hi] with your mouse. For me, when I selected my mouse from the menu, the message "hi: focussing on M720 Triathlon" appeared, but after I clicked on poll 10 message and scrolled with the mousewheel, no data came from the outlet of [hi]. The [3 1] message box appeared that way when I loaded the help patch page before I selected the mouse from the umenu and started polling. I tried to route the messages and all of them received no input. I dragged my mouse over the patch cord stemming from the outlet of [hi] and scrolled the mousewheel, and the pop up remained no data. I'm not sure what the problem is, but I am grateful for your help.

Source Audio's icon

can you click on info and post output to console ?
That logitec is a complicated one, is it bluetooth ?
Maybe that is the problem...

Source Audio's icon

P.S. try to close patcher with hi object and open it again.
Sometimes HI stops working if device got disconnected - reconnected.

Jake Exkorn's icon

I closed the patch, reopened the help file, and recreated the setup. Then I clicked on info and have attached screen shots of the console and patch. I then selected M720 Triathlon, clicked on poll 10, hovered the mouse over the patch cord coming from the outlet of [hi], and I still got no data pop up. The mouse is bluetooth, so maybe you are right about that being a problem. Although, I also haven't been able to get [hi] to send data when using the trackpad either. So, I'm not sure why that is.

Source Audio's icon

that is strange, because you should receive at least something
direcly at HI output.
also it lists M720 Triathlon 2 but prints focusing on M720 Triathlon.
You see - trackpad and keyboards have several descriptors. Not all work.

Can you select all your devices one after another, with polling activated,
and try to move mouse, type something on a keyboard etc till at least
something gets out of hi object ?

And I see you have a bunch of stuff connected, external bluetooth keyboard,
headset (mikey driver), is that causing troubles ?

Jake Exkorn's icon

I have tried all of the devices with polling on, and I can only get output from my headphones. I tried typing with the keyboard. I tried setting the name as M720 Triathlon 2 (one time with quotes around it and another time without quotes), and it said that it wasn't recognizable. I think the numbers to the far right are listing the 9 devices in order but are not included with the device names.

Perhaps, the Apple Mikey HID Driver is the only device I have that is compatible with [hi]. Although, I just tried using the Apple Mikey HID Driver again, and I haven't been able to get any more output from [hi] aside from the two times indicated in the screen shot below.

Source Audio's icon

Mikey driver is using headset buttons, or similar from keyboard.

What OS are you running ?
It could be some weird privileges issue, like system not allowing Max to
use devices ...

Jake Exkorn's icon

I am running Big Sur version 11.6

Source Audio's icon

I don't run anything newer than high sierra.
So can't really test what could be wrong.

Could you try to run max by showing package contents,
and doubleclicking on Max in Max.app/Contents/MacOS.

That will start Max from terminal, and maybe you will see some errors in termninal window.

next I would look at is to check all security settings, gatekeeper , assistive devices
and maybe give Max full access to all.

Jake Exkorn's icon

I tried running Max from terminal, and I noticed no errors. I checked the security and privacy settings and gave Max access to input monitoring, accessibility, and bluetooth. Specifically, after giving access to input monitoring, [hi] gave output when the bluetooth keyboard was selected but gave no output when trackpad devices or mouse device was selected.

I find it interesting that there is a discrepancy between the macOS User Guide (which I got access to from Finder/Help toolbar/MacOS help) and Security & Privacy menu. In the macOS User Guide, it says "some apps can monitor your keyboard, mouse, or trackpad...you can decide which apps are allowed to monitor your devices." Whereas, in the Security & Privacy menu, it says "allow the apps below to monitor input from your keyboard even while using other apps." It says nothing about mouse or trackpad in the Security & Privacy menu. I've attached a screen shot with the MacOS User Guide and Security & Privacy menu side by side.

I do appreciate your help with this even if I haven't been able to accomplish some of my goals yet. You have provided me with advice that I imagine will be helpful for future troubleshooting as well.

Source Audio's icon

I hope you are on good trace.
It is really getting too silly with all that restrictions.

Roman Thilenius's icon


the feature itself would open up new doors though (as soon as applications like max will allow to send keyboard commands to the system.)

(my first positive comment about apple in 2022)