When drawing a section view, first a list of objects to draw is made.
Starting with the objects selected by the section plane, any groups or
group-like objects are recursively expanded. The resulting list contains
all contained objects, but also the expanded groups themselves (due to
Draft.get_group_contents with addgroups set).
This list of objects is then further categorized and processed. In this
categorization, there was already an exception for DocumentObjectGroup
instances, which were omitted from the resulting `nonspaces` list
(presumably since there is no point in drawing the groups themselves
when their contents are already in the list).
However, any groups that only contain flat objects would be caught by
`looksLikeDraf()` and added to the `drafts` list, before this exception
could ignore them.
This causes these groups to be processed by Draft.get_svg, which does so
by calling itself recursively on the group contents. Effectively, this
means that the contents of such groups is drawn on the section view
twice. Even more, since Draft.get_svg does not do a visibility check
like Arch.getSVG does, this causes invisible objects to show up when not
intended.
This commit fixes this by moving the DocumentObjectGroup exception a bit
further up, so all these objects should be dropped.
An alternative fix might be to pass addgroups=False to
Draft.get_group_contents (in getSectionData), but that also prevents
group-like objects (Building, BuildingPart, Space, Site) from being
returned, but those likely need to be returned so they can be sectioned
if needed (though if just spaces are needed, then
Draft.get_group_contents also have a spaces argument to return just
those).
Provide currently set color as initial value for getColor() to enable
convenient incremental changes.
Do not change the colour if the Cancel buton was pressed.
Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
Several improvements to the javascript in the template:
* Render on demand rather than continuously
* Support high-DPI displays
* Fix the frustum depth for both cameras
* Deal correctly with the browser window being resized
* Only show controls for objects with geometry
Also some changes made for code clarity:
* Use 'const' and 'let' instead of 'var', as appropriate
* Use for...of and .map() instead of iterating over arrays
using a loop counter
This ensures the rotation edge and mode GUI elements are cleared when starting
to add or edit a component. Previously, when adding a new component or
editing one without rotation, the GUI elements would retain the value
from the previously edited component, which made it hard to check that
components did not have any rotation, and would make it easy to
accidentally add rotation to components that did not need it (just by
clicking edit and confirming).
LGTM identified a few minor issues in the Dice3DS code -- none of them
appear to be real errors, so the changes here should not affect the
behavior of the code.
LGTM complains about the unused variable in a loop that is really only
using the variable to iterate a set number of times. This replaces that
loop with a multiplication by the length of the array, eliminating the
unused iteration variable and clarifying the intent of the code.
Removes unused imports as reported by LGTM.
There are exceptions: `import Arch_rc` is shown as an alert, but has side effects. It's not clear what the best thing to do in those cases is, so I've left them for now.
A relative profile can now be used if it references itself. This fixes a compatibility issue with the V0.18 version of ArchRoof, where the first profile initially always references itself.