Skip to content

Add png file json file unique name and take different editOptions - #214

Open
JorisGoosen wants to merge 3 commits into
masterfrom
addPngFileJsonFileUniqueName
Open

Add png file json file unique name and take different editOptions#214
JorisGoosen wants to merge 3 commits into
masterfrom
addPngFileJsonFileUniqueName

Conversation

@JorisGoosen

Copy link
Copy Markdown
Contributor

No description provided.

Virtuoos Automatisch added 3 commits July 27, 2026 20:34
The response used the local 'plot' variable (original, pre-editing) instead of
jaspPlotCPP (which is updated to newPlot when editing succeeds).
This caused imageEdited() on the desktop to receive and store the pre-edit
editOptions, corrupting the user's plot customizations.
@JorisGoosen
JorisGoosen requested a review from vandenman July 29, 2026 17:31
@JorisGoosen

Copy link
Copy Markdown
Contributor Author

Maybe this pr is not really needed. But my bot suggested it during jasp-stats/jasp-desktop#6296 which works around any problems with editOptions dissappearing. There is also some commented out merge code in here somewhere. What do you think @vandenman ?

@JorisGoosen

JorisGoosen commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author
   # uncommenting this applies the edits previously done with plot editing to an older figure to the new figure.
    # see https://github.com/jasp-stats/INTERNAL-jasp/issues/1257 for discussion on what needs to be done before we can do this.

    # e <- try({
    #   # same construction as in editImage
    #   newPlot <- ggplot2:::plot_clone(plot)
    #
    #   newOpts       <- jaspBase::fromJSON(oldPlotInfo[["editOptions"]])
    #   oldOpts       <- jaspGraphs::plotEditingOptions(plot)
    #   newOpts$xAxis <- list(type = oldOpts$xAxis$type, settings = newOpts$xAxis$settings[names(newOpts$xAxis$settings) != "type"])
    #   newOpts$yAxis <- list(type = oldOpts$yAxis$type, settings = newOpts$yAxis$settings[names(newOpts$yAxis$settings) != "type"])
    #
    #   newPlot <- jaspGraphs::plotEditing(newPlot, newOpts)
    # })
    #
    # if (!inherits(e, "try-error"))
    #   plot <- newPlot

Ive now worked around this in jasp-desktop by having a complicated reapply system. This also solves complete refreshes and stuff like that. But uncommenting the above might still be nice. It could avoid some ugliness potentially.

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

Successfully merging this pull request may close these issues.

1 participant