De-parenting has unwanted side effects #6

Open
opened 2026-02-20 10:13:10 -05:00 by deekerman · 11 comments
Owner

Originally created by @rogerl50 on GitHub (Jan 3, 2021).

If I'm editing a widget's JSON and remove its parent attribute, or add one, then usually it disappears off the board, or at least moves to some unexpected location. This of course is because the coordinates change from absolute to relative. It would be really user-friendly if a change in parentage caused the code to revisit the coordinates, probably by assuming that the widget is at the place on the screen where the user wants it and computing new xy coordinates from the position of the holder.

Originally created by @rogerl50 on GitHub (Jan 3, 2021). If I'm editing a widget's JSON and remove its parent attribute, or add one, then usually it disappears off the board, or at least moves to some unexpected location. This of course is because the coordinates change from absolute to relative. It would be really user-friendly if a change in parentage caused the code to revisit the coordinates, probably by assuming that the widget is at the place on the screen where the user wants it and computing new xy coordinates from the position of the holder.
Author
Owner

@UltimateGeek commented on GitHub (Jan 4, 2021):

Another scenario of bad coordinates I've run into is the opposite of de-parenting:

  1. I hand modify a widget to make it a child of another widget
  2. I forget to modify the X & Y values to be relative
  3. It disappears off the board
  4. So I have to move the parent's position on the board to recover the child widget

Just another scenario where it would be nice for the client to "revisit" (i.e. validate) the coordinate of a widget, and it automatically changes the X & Y to a safe value.

@UltimateGeek commented on GitHub (Jan 4, 2021): Another scenario of bad coordinates I've run into is the opposite of de-parenting: 1. I hand modify a widget to make it a child of another widget 2. I forget to modify the X & Y values to be relative 3. It disappears off the board 4. So I have to move the parent's position on the board to recover the child widget Just another scenario where it would be nice for the client to "revisit" (i.e. validate) the coordinate of a widget, and it automatically changes the X & Y to a safe value.
Author
Owner

@rogerl50 commented on GitHub (Jan 4, 2021):

Yes. And sometimes you don't know where it went, and sometimes it's off the board and you have to go to Ghetto to find it. That's basically one of the two scenarios I was trying to describe in the original issue.

@rogerl50 commented on GitHub (Jan 4, 2021): Yes. And sometimes you don't know where it went, and sometimes it's off the board and you have to go to Ghetto to find it. That's basically one of the two scenarios I was trying to describe in the original issue.
Author
Owner

@RaphaelAlvez commented on GitHub (Jan 5, 2021):

This can be easily fixed using a macro on Ghetto. I was thinking about creating on for parenting but I may do both

@RaphaelAlvez commented on GitHub (Jan 5, 2021): This can be easily fixed using a macro on Ghetto. I was thinking about creating on for parenting but I may do both
Author
Owner

@robartsd commented on GitHub (Jan 25, 2021):

Perhaps the built in JSON editor should offer to change coordinates if parent has changed but x, y position has not.

@robartsd commented on GitHub (Jan 25, 2021): Perhaps the built in JSON editor should _offer_ to change coordinates if parent has changed but x, y position has not.
Author
Owner

@96LawDawg commented on GitHub (Dec 5, 2021):

Closed by #521.

@96LawDawg commented on GitHub (Dec 5, 2021): Closed by #521.
Author
Owner

@rogerl50 commented on GitHub (Dec 6, 2021):

This is not the same problem. While fixedParent prevents de-parenting when moving a widget, this PR wants the widget to not physically move onscreen when de-parented in the editor.

@rogerl50 commented on GitHub (Dec 6, 2021): This is not the same problem. While `fixedParent` prevents de-parenting when moving a widget, this PR wants the widget to not physically move onscreen when de-parented in the editor.
Author
Owner

@96LawDawg commented on GitHub (Dec 6, 2021):

Sure. Makes sense. I was too eager to close some old issues. Actually this might be easier to solve now with _absoluteX and Y.

@96LawDawg commented on GitHub (Dec 6, 2021): Sure. Makes sense. I was too eager to close some old issues. Actually this might be easier to solve now with _absoluteX and Y.
Author
Owner

@robartsd commented on GitHub (Dec 6, 2021):

With #903 setting x to _absoluteX, y to _absoluteY, scale to _absoluteScale, and rotation to _absoluteRotation, then setting parent to null should cause the widget to not move at all except for any layering effect changes.

@robartsd commented on GitHub (Dec 6, 2021): With #903 setting `x` to `_absoluteX`, `y` to `_absoluteY`, `scale` to `_absoluteScale`, and `rotation` to `_absoluteRotation`, then setting `parent` to `null` should cause the widget to not move at all except for any layering effect changes.
Author
Owner

@robartsd commented on GitHub (Feb 12, 2023):

One difficulty with fixing this is that the JSON editor tries to update live as you type (which generally we want to keep), so there is not really an way to determine if x and/or y have been changed without a fairly complicated system for tracking edits.

We could add a Change Parent button. I think the button should give the option to update x,y so that the widget's relative position in the room does not change (default option if widget parent get changed to or from null, but defaulting to keeping the widget x, y unchanged if changing from one parent to another).

@robartsd commented on GitHub (Feb 12, 2023): One difficulty with fixing this is that the JSON editor tries to update live as you type (which generally we want to keep), so there is not really an way to determine if x and/or y have been changed without a fairly complicated system for tracking edits. We could add a Change Parent button. I think the button should give the option to update x,y so that the widget's relative position in the room does not change (default option if widget parent get changed to or from null, but defaulting to keeping the widget x, y unchanged if changing from one parent to another).
Author
Owner

@96LawDawg commented on GitHub (Feb 13, 2023):

I've been thinking about this issue as well. I don't think we need or should do that. It is overly complicated. When building a room, I sometimes change parents just by changing the parent name by one letter or number. An automated process would get in the way.

And after more thought, I don't think this is as big as a problem as it once was. We have a zoomed out room view, we have the JSON Editor with its search features and the tree. None of that existed when this issue was created. The fact that it is 2 years old with no solution has as much to do with the fact that we have adequate work around solutions as it does with the fact that it is a little complicated to fix.

I would close this issue.

@96LawDawg commented on GitHub (Feb 13, 2023): I've been thinking about this issue as well. I don't think we need or should do that. It is overly complicated. When building a room, I sometimes change parents just by changing the parent name by one letter or number. An automated process would get in the way. And after more thought, I don't think this is as big as a problem as it once was. We have a zoomed out room view, we have the JSON Editor with its search features and the tree. None of that existed when this issue was created. The fact that it is 2 years old with no solution has as much to do with the fact that we have adequate work around solutions as it does with the fact that it is a little complicated to fix. I would close this issue.
Author
Owner

@robartsd commented on GitHub (Feb 13, 2023):

I've been thinking about this issue as well. I don't think we need or should do that. It is overly complicated. When building a room, I sometimes change parents just by changing the parent name by one letter or number. An automated process would get in the way.

I agree that we should leave the current behavior as is when editing JSON text directly in the JSON editor.

We might consider changing the behavior when editing the raw JSON in the "basic" editor (although I don't think anyone is actually doing that). We might also want to make a button in one or both editors.

@robartsd commented on GitHub (Feb 13, 2023): > I've been thinking about this issue as well. I don't think we need or should do that. It is overly complicated. When building a room, I sometimes change parents just by changing the parent name by one letter or number. An automated process would get in the way. I agree that we should leave the current behavior as is when editing JSON text directly in the JSON editor. We might consider changing the behavior when editing the raw JSON in the "basic" editor (although I don't think anyone is actually doing that). We might also want to make a button in one or both editors.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/virtualtabletop#6
No description provided.