SciChart - LineArrowAnnotation not disappearing when visibility is set to false - scichart

I have a few annotations in my graph, 3 to be exact. Two of them are text annotations, which I just need to stay visible, and that's what they're doing.
But I also have a LineArrowAnnotation, which I need to appear and disappear depending on the state of my underlying data model. I have bound the Visibility property bound to a bool property in the view model.
<sci:LineArrowAnnotation Visiblity="{Binding ArrowVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
Pressing F12 on the "ArrowVisible" property in Xaml editor takes me to the appropriate place in the view model. I've verified in debugger that the value of my view model property is set according to my expectations and the getter for of the property is accessed when a change is triggered.
As you can in the screenshot, I can position the arrow by manipulating its X1,X2,Y1,Y2 coordinates (left and center). But if I try to set visibility in the same way, the tip of the arrow is still visible (right). I'm assuming the whole arrow is actually visible, but since the change that disables the arrow also sets all coordinates to 0, it's displayed at the edge of the graph and therefore only partially visible.
As a workaround, I've even tried to bind the stroke thickness of the annotation, setting it to 0 if the arrow is supposed to be hidden.
StrokeThickness="{Binding ArrowStrokeThickness}"
This too did not have any effect. However, it served to verify that the binding is correct and the value is read, because a breakpoint in the ArrowStrokeThickness getter was hit as expected. (I've added this property just for this workaround, so it can't have been accessed from anywhere else).
I realize I could work around it by placing the arrow outside of the visible range when it's not supposed to be visible, but that's an ugly solution that would require me to hack my view model.
I'd like to add that while I'm still using SciChart version 3.31, I've had the solution briefly updated to version 4.0.5 (I've since rolled back this change) and the arrow annotation was behaving the same.
Edit: deleted picture for intellectual property reasons.

This question has been asked many times on the SciChart Forums here, here, here and here.
The accepted solution is to bind to Annotation.IsHidden (boolean DependencyProperty) to show or hide an annotation.

So I found out that the LineArrowAnnotation inherits the Visibility property from UIElement. It seems that it wasn't supposed to actually support it. Either that, or the implementation is incorrect. Anyway, I looked at which properties actually belong to the LineArrowAnnotation class, and I managed to hide the arrowhead by binding the HeadLength property and setting it to 0 when the arrow is supposed to be hidden.

Related

Moving components with bindings outside of their parent

In my project I'm working on styling some overlays. Because of the nested component structure I'm running into some problems here. The intended solution is to move the overlay somewhere closer to the app root while preserving data bindings, making the css styling less restricted.
I've managed to set up a prototype using Renderer2.appendChild(...). When the overlay is shown, the ngOnInit of the overlay appends the overlay to another DOM element.
With my current code I can either get the input or output binding to work (but not both), based on moving an empty comment <!----> found directly in front of the overlay.
From my understanding (Empty comments in Angular application) Angular needs this comment, but Renderer2.appendChild does not account for it (maybe it's not meant to be used for components, only for 'raw' html?).
Demo:
Here's the prototype presenting both issues I am stuck on: https://stackblitz.com/edit/angular-pg24om
Visibility of the overlays (shown below the labels) can be toggled with a button. The submit buttons inside the overlay logs the input to the console using an #Output event emitter. Pressing change text changes an #Input property.
Without moving the overlay, input and output binding works like expected.
Incorrect input binding: If I choose to move the empty <!----> comment together with the overlay, my input binding seems to stop working. Pressing Change text does not change the random number I pass to the component. Output binding still works fine in this scenario.
Incorrect destruction: If I don't move the empty comment, Angular fails to clean up the component when the visibility is hidden using the Toggle visiblity button. That said, while the component is alive both input and output binding remains functional.
If anyone knows how to get this to work, I'd greatly appreciate some help. I did see other methods of creating overlays using factory resolvers and detaching views, but being able to move the component while preserve bindings in the HTML template will save us a lot of time otherwise spent on changing a lot of components.
Edit: I forgot to mention that the error Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. occurs when attempting to remove the overlay without the moved comment. Angular is attempting to delete a #comment element from the overlay, but it fails to do so because the comment is still in the div where the overlay template resides. That's the reason I tried to move the comment together with the overlay.

How to set Autodesk Setting to front?

I am having an app, which uses the Forge API. The UI displayed when pushing the Forge button "Settings" in "settingsTools group", overlaps one of my buttons.
However since my app zIndex is set (I am in react code) the click upon close of the setting UI, triggers my buttons instead of the close button.
Hence, I am intrested in setting the "Settings UI" to front so the click upon the close button triggers close. My front end code is in the react framework hence a simple zIndex parameter to set could do the trick.
How can I do so?
Instead of playing with hacky ways, consider using the docking panels provided by Forge Viewer. From my understanding, it can also work with React.
To elaborate the usefulness of panels, consider the following example:
Here I have a floating div, showing me some information related to the model. Obviously I've set a high z-index, to bring it upfront and here I have the same problem as you have - when opening things like settings, properties, model tree, etc, they all appear behind my div. Moreover, when changing the size of the window, I have to deal with my div position.
On the other hand, Forge Viewer uses everywhere panels, like this very Settings dialog.
Thus, if you would place your button into this kind of panel, this would save you from headache with z-index, docking, rescaling etc, as all the panels are working nice one with each other, as the below Robot Control Panel:
For more information on how to create a panel, I suggest checking http://learnforge.autodesk.io/#/viewer/extensions/panel

Autodesk Viewer UI Code Location and Edit Suggestions Needed

I need some help tweaking the Autodesk Viewer UI. I am working on the files as provided by a localised version output from http://extract.autodesk.io/.
I have not done any custom editing. I need help locating the relevant code and suggestions for the changes in the following areas:
The Model Browser docking panel. This opens by default with the first group in the tree Expanded (see picture). I want this first element and all other elements to open by default as Collapsed, so just the parent names are shown.
Staying in Model Browser. The Scroll Bars, (seen when model elements names are listed beyond the Model Browser window size) display correctly in the Opera and Chrome browsers,
however, they display unstyled as wide windows style scroll bars in the Firefox browser. What is needed for Firefox to display scrollbars as intended?
What code might override camera zoom property AFTER correctly loading default zoom value ?
The viewer version from http://extract.autodesk.io/ imports the scene camera properties for the start view ok, but overrides the Zoom property with another value shortly after intial page load.
1.I want this first element and all other elements to open by default as Collapsed, so just the parent names are shown.
Unfortunately far as I know there's no straightforward, native config option in Viewer to achieve this. However you can:
Hook an one-off click listener onto Model Browser button to programmatically fire a click on the corresponding notes you'd like to collapse, or directly add ‘.collapsed’ class to them. You can get a hold of the nodes either by their lmv-nodeid or their label text:
<div lmv-nodeid="9" class="collapsed group visible">
<lmvheader style="padding-left: 13px;">
<div class="visibility"></div>
<label>Switch:1</label>
</lmvheader>
</div>
Extend and build your own browser using the instanceTree and Autodesk.Viewing.UI.DockingPanel, see an example here
2.What is needed for Firefox to display scrollbars as intended?
Here is a great answer to your question. But looks like the status quo is still far from perfect, with no definite hack discovered so far. So again for a thorough solution you'd need to create your own styling (can do so with the help of something like) and apply them to .docking-panel and append .model-structure-panel or any other panels you'd like to narrow the scope to.
3.What code might override camera zoom property AFTER correctly loading default zoom value ?
This should be the code you are after.
You can manipulate camera with viewer.autocam.goToView( newView ), and see below for a sample view config:
const newView = {
position: newPosition,
up: currentView.up,
center: newCenter,
pivot: newPivotPoint,
fov: currentView.fov,
worldUp: currentView.worldUp,
isOrtho: (currentView.isOrtho === false)
}

Access Form Random Boxes with Dashed Lines

After any handful of events, these random square boxes with dashed lines appear all over my application's forms. I can't figure out why or how they are being generated. Is there some type of workaround for this issue? It doesn't seem code or design related.
It's a known bug in Access 2010 (and 2007?). You have a button on your form that has an image on it, with the size of the dashed rectangle.
The rectangle appears once the button has had the focus, and it won't go away. :(
Your database was probably migrated from Access 2003?
See here or here or here.
A possible solution from the second link:
Set the 'Picture Property Storage Format' property in Options\Current Database to 'Preserve source image format'. Try setting that property as well as resetting the picture property in the control.
I must try this sometimes, too. It's rather annoying.
Or if you are not really attached to the image, changing the button to text-only will be the easiest fix.

Making JPopupMenu's submenus heavyweight

http://java.sun.com/products/jfc/tsc/articles/mixing/index.html advices how to make JPopupMenus heavyweight. Just set the property:
setLightWeightPopupEnabled(false);
It works fine, but if I have submenus in the popup, implemented as JMenu items, they don't seem to inherit the popup's heavy weight. JMenu doesn't have a method to make itself heavyweight, and using an AWT Menu isn't an option, since I want to put Swing items into it.
How do I make the submenus heavyweight, too?
It seems to be a Swing bug. Setting the global property
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
works! Also submenu JMenu items go heavy, as they should. Obviously the per-instance method setLightWeightPopupEnabled should work similarly, but it doesn't.
I filed a bug (Bug Id: 7005406) on this, but I leave the question here just in case that someone else bumps on this. So the solution is to use the global setting until the bug gets fixed.