Package patcher load resize js stopped working

diatom's icon

Hello

I've a patcher package with dirs

/init/objectmappings.txt
/patchers/pollen.eq.maxpat
/patchers/resize_this_patcher.js

The js contains:

function resize() {
  this.patcher.box.varname = "bp_" + Math.random()*10000;
  this.patcher.parentpatcher.message("script", "sendbox", this.patcher.box.varname, "patching_size", 70, 70);
  this.patcher.box.varname = "";
}

The objectmappings.txt contains

max objectfile pollen.eq pollen.eq;
max definesubstitution pollen.eq bpatcher @name pollen.eq.maxpat @offset -20. -20. 

When I open a patcher having restarted Max, and do a new object and select pollen.eq I get a standard 128x128 px bpatcher. The js resize function is being ignored. I've tried with and without defer. This was working, but has stopped working. I'm on 8.5.6. How can I make the UI component resize when I drop it into a parent patcher?

This is how it drops

I'd like it to resize to this
This is how I'm calling it inside the pollen.eq.maxpat patcher.

diatom's icon

I've tried to move the resize_this_patcher.js into a subdirectory called javascript in line with https://docs.cycling74.com/max8/vignettes/packages?q=package but after restarting Max 8.6, I got the same. I'm unsure what I'm missing here to make the javascript work.

Ben Bracken's icon

This generally appears to be working here, but I might be missing something important. Can you attach a simple example?

diatom's icon

OK this is interesting - I will cross post, as I'd forgotten I'd raised the original problem I had here in another post.

The package works OK when I use a brand new patcher, but when I use my mother patcher which has been hanging around for a couple of months waiting for me to complete the package components, it does not.

New patcher works, in front of my main desk patcher which does not.

There's not anything wrong with the Max paths as both patchers will use the same path. I triggered the deployment of both bpatchers using 'n' as before. It appears that basically, the javascript is not being triggered by my main mother desk patcher, but is by a brand new mother.

diatom's icon

OK one of the patchers was in presentation mode, and one was in patching mode. Perhaps I should not have the background the same colour as the modes are getting quite similar to each other.