Lock the visible-signature toggle to the selected field - #477
Merged
Conversation
Selecting an existing signature field forced the visible flag on and disabled the side-panel checkbox, but the menu item and the toolbar toggle stayed switchable. Turning them off changed nothing about the output - SignerLogic sets visible=true for a field-placed signature regardless - so the status badge just started disagreeing with the signature that came out. Both toggles now lock together with the checkbox; "(create new field)" is the way back to an invisible signature. Turning the flag back on then placed a 100x100 box in the lower-left corner of the page: selecting a field resets the position options to their defaults, and the auto-placement accepted that untouched default rectangle as a last-known position. The same box appeared on a fresh profile, which has never held any other coordinates. The default rectangle is now recognised as "nothing chosen yet" by both the auto-placement and the preset-load path, which carried a copy of the check, so the intended bottom-right fallback applies. The auto-placement also stays out of the way entirely while a field is selected - the field's own /Rect decides where the signature goes. Deselecting a field left the forced-on visible flag behind with no rectangle on screen, which would have signed at the default coordinates without showing anything; the rectangle now comes back with it.
kwart
commented
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #473 (sign into an existing signature field), from testing the feature.
The visible-signature toggle and the field selection disagreed
Selecting a field forces
visible=trueand disables the side-panel checkbox, butmenuVisibleSigandbtnVisibleSigstayed switchable. Unchecking them changed nothing about the output —SignerLogic.validateSigField()setsoptions.setVisible(true)for a field-placed signature regardless — it only flipped the status badge to "invisible signature". Both toggles now bind tonoDocument.or(sigFieldSelected)and lock together with the checkbox. (create new field) is the way back to an invisible signature; a zero-size field rectangle still gives one anyway.The blue box in the lower-left corner
Flipping the flag back on placed a 100×100pt rectangle at the page origin.
onSigFieldSelected()resets the position options toDEFVAL_LLX..DEFVAL_URY(so the "position ignored" warning does not fire at signing time), andautoPlaceVisibleSignature()accepted that untouched default as a valid last-known position instead of falling through to its bottom-right default. This is not specific to the new feature — a fresh profile has never held any other coordinates, so the very first Visible signature toggle always landed in the lower-left corner.The
fitscheck was duplicated inVisibleSignatureCoordinator.pushSigningToPlacement()(the preset-load path, whose javadoc already claimed stale defaults were guarded against — they weren't). Both now call onehasUsablePosition()that rejects the default rectangle.autoPlaceVisibleSignature()additionally does nothing at all while a field is selected: the field's own/Rectdecides the position, so a placement rectangle would only promise something the signing path ignores.Deselecting a field left visible=ON with nothing on screen
The forced-on flag survives the deselection, so signing would have placed the appearance at the default coordinates with no rectangle drawn. Deselection now re-runs the auto-placement (guarded on
hadField && visible, so document open/close — both of which clearvisiblefirst — are unaffected).Verification
Driven headlessly through the real
MainWindow.fxmlcontrollers under Monocle, with a generated one-blank-field PDF:Preferences turned out not to be involved:
PreferencesController.persist()andrefreshActiveEngineFromConfig()never touch the signing view model, and the box does not appear across a dialog round-trip.5 new cases in
VisibleSignatureCoordinatorTest;mvn testgreen across all modules. Docs and the 3.2.0 release notes updated — the lower-left box gets its own bullet since it is pre-existing behaviour, while the toggle lock is part of the unreleased feature.