I have some locators in a LocatorPane
and want to let users remove them. Unfortunately, it seems doing this conflicts with the Appearance
option.
Here's an example of the issue:
DynamicModule[{pts = {{-1, 1}/2, {1, 1}/2}, lbls = {"A", "B"}},
Column @ {
Dynamic @ pts,
LocatorPane[Dynamic @ pts, Framed @ Graphics @ {},
LocatorAutoCreate -> {0, Length[pts]},
Appearance -> lbls
]
}
]
As you can see if hold the alt key (CMD on MacOS) and click on locator A, the label of the other locator B is incorrectly changed to A. Any simple workarounds to this?
Analysis:
This is the form of LocatorPane
we're using:
According to the docs, the option LocatorAutoCreate
allows deletion of locators by CMD-clicking on them.
I think that the proper index is deleted in first arg Dynamic@pts
but the corresponding list of labels in the Appearance
option is not (this I believe is the bug):
I'm not attached to using LocatorPane
, perhaps EventHandler
+ Locator
's is a way to go?
{{-0.515,0.43},{0.55,0.45}}
not{{-1/2,1/2},{1/2,1/2}}
. What actually do you try to reproduce with this code? $\endgroup$