Refactor: Systematize semantics and roles of ids and labels for Elements #149

Open
opened 2026-06-01 23:44:08 +00:00 by glen · 0 comments
Owner

In the original PR discussion where this came up:

What I am trying for is the id to be the primary identifier of an entity throughout dyna3, and for the label to (a) be a secondary characteristic specifying one aspect of the decoration of an entity, much akin to "color," and (b) ultimately default to the id if no label other than that has ever been specified. So in the end if our canonical name-list for points ends up being A,B,C,... then I would expect the first point created with no id specified have id "A" and thereby an implicit label "A" and so on. I would expect to see in the graphic display, assuming that label display is on for this point, the text "A" plotted next to this point, and in the outline view, that this point is simply designated as A; there is no need to indicate an id and label separately, because the id is always shown and no label has ever been set.

Then maybe I create a bunch more points, but then decide I want the point with id "I" to have label "centroid" so I change it, however that's currently done. I would then expect that (a) assuming label display is on for this point in the graphic display, the text plotted next to the point changes from "I" to "centroid", and (b) the primary designation of this point in an outline view remains "I", but that there might well be some indication that the label has been set, so the outline might change from showing just I to showing (say) I "centroid" or something like that.

Originally posted by @glen in #148 (comment)

Concretely for the behavior of dyna3, this would mean:

  • Either we change things so there might be no label, and in that state, id is used wherever label would be needed; or we populate label with the id at creation time. I pretty strongly prefer the former, because it avoids the ambiguity between an element that has id X and label X just because I never gave it any other label (in which case if you id-change it to Y you'd want to change the label, too) and an element that has id X and that I explicitly labeled X (in which case the label should be left alone even if you change id).

  • The primary identifier shown in an outline sort of view is the id, with the label only shown, in some visually subordinate way, if it has been set (or in the less preferred option, if it differs from the id).

  • In a graphical sort of view, in the typical default state just the text of the label is rendered next to the element, and the id is not displayed. But it may be that when an element is selected, this display changes to include the id, and to have affordances to display additional information at that graphical location.

  • Note that in many diagrams, one wants many elements to be drawn with no label at all. We need to decide if this is accomplished by explicitly setting the label to the empty string, or whether there is additional checkbox that turns off label display while allowing one to keep something in the label value. (My guess is likely the latter.)

Other labeling features, like the ability to display regulator values within the label (so for example the label on an angle could include the measure of the angle, as is common in many dyngeo systems), would be addressed in other/future issues -- those things are outside the scope of this issue.

In the original PR discussion where this came up: >What I am trying for is the id to be the primary identifier of an entity throughout dyna3, and for the label to (a) be a secondary characteristic specifying one aspect of the _decoration_ of an entity, much akin to "color," and (b) ultimately default to the id if no label other than that has ever been specified. So in the end if our canonical name-list for points ends up being A,B,C,... then I would expect the first point created with no id specified have id "A" and thereby an implicit label "A" and so on. I would expect to see in the graphic display, assuming that label display is on for this point, the text "A" plotted next to this point, and in the outline view, that this point is simply designated as `A`; there is no need to indicate an id and label separately, because the id is always shown and no label has ever been set. >Then maybe I create a bunch more points, but then decide I want the point with id "I" to have label "centroid" so I change it, however that's currently done. I would then expect that (a) assuming label display is on for this point in the graphic display, the text plotted next to the point changes from "I" to "centroid", and (b) the primary designation of this point in an outline view remains "I", but that there might well be some indication that the label has been set, so the outline might change from showing just `I` to showing (say) `I "centroid"` or something like that. _Originally posted by @glen in https://code.studioinfinity.org/StudioInfinity/dyna3/pulls/148#issuecomment-3894_ Concretely for the behavior of dyna3, this would mean: * Either we change things so there might be no label, and in that state, id is used wherever label would be needed; **or** we populate label with the id at creation time. I pretty strongly prefer the former, because it avoids the ambiguity between an element that has id `X` and label `X` just because I never gave it any other label (in which case if you id-change it to `Y` you'd want to change the label, too) and an element that has id `X` and that I explicitly labeled `X` (in which case the label should be left alone even if you change id). * The primary identifier shown in an outline sort of view is the id, with the label only shown, in some visually subordinate way, if it has been set (or in the less preferred option, if it differs from the id). * In a graphical sort of view, in the typical default state just the text of the label is rendered next to the element, and the id is not displayed. But it may be that when an element is selected, this display changes to include the id, and to have affordances to display additional information at that graphical location. * Note that in many diagrams, one wants many elements to be drawn with no label at all. We need to decide if this is accomplished by explicitly setting the label to the empty string, or whether there is additional checkbox that turns off label display while allowing one to keep something in the label value. (My guess is likely the latter.) Other labeling features, like the ability to display regulator values within the label (so for example the label on an angle could include the measure of the angle, as is common in many dyngeo systems), would be addressed in other/future issues -- those things are outside the scope of this issue.
Sign in to join this conversation.
No description provided.