Draw2d: Containing RectangleFigure will sometimes cuts off text when zoomed. (Pictures included) - word-wrap

In my program I have a bunch of RectangleFigures where each figure holds text. The text is held in a TextFlow which is held by FlowPage to allow word wrapping. RectangleFigure then uses getPrefferedSize() to make itself just big enough to hold it's text (using a fixed width).
These RectangleFigures are held by a ScalableLayeredPane. The problem rises when I try to zoom by calling setScale(). Most of the time it works fine but occasionally the ends of the text will be cut off. If I zoom again the figure will correct itself. I should also say that I have tested my program using Figure instead of RectangleFigure with the same result.
Has anyone dealt with this bug before and can shed some light on why this is happening and/or know of any workarounds?
I havn't included any code because this is a rather large program and relevant chunks of code are spread out. But if you would like to see the code let me know and I will try piecing it together.

I was holding the text inside a Figure and that was the Figure I was calling getPrefferedSize() on. But I then put that Figure(lets call it textFigure) inside a second Figure(called containerFigure). I was essentially doing the equivalent of containerFigure.setSize(textFigure.getPrefferedSize()).
You're probably wondering why I was doing that. Well originally I planned on having containerFigure hold multiple things instead of just textFigure. I ended up coding it differently but forgot about the unnecessary extra layer.
So even though containerFigure was technically the size it needed to be scaling caused problems. But when I removed containerFigure and started placing textFigure directly on the screen this bug was fixed.
This is a fairly specific error on my part so I don't know how much help this will be to others. To make it more broad if you're having some kind of sizing issue just check to see how the size of parent Figures are being set. Using sizes from child Figures might be incorrect and/or causing problems.

Related

Blurred text in the TStatusBar control

I have for a very long time experienced a hugely annoying problem with the TStatusBar VCL control, a thin wrapper around the Win32 status bar control.
Since this appears to me as a very common and frustrating issue, I am very surprised Google (and StackOverflow) doesn't seem to know much about it.
The problem is that the status bar text becomes very blurred when it hasn't changed for a while; the precise conditions are still unknown to me. But I see this every day:
If one of the panels has its text updated, the new text is rendered correctly (see last panel):
Is this something that only happens when I am in the vicinity of running Delphi processes, or is it indeed a known issue? More importantly, is there a known cure? (And, academically, why does this happen? It wouldn't surprise me if it is related to transparent drawing of anti-aliased text by code originally designed for unthemed Win9x.)
I have tried to enable double-buffering, but I am not sure if that completely resolves the issue. (I have seen even worse behaviour in non-double-buffered list view controls, which is resolved by making them double-buffered.)
I made all status bars in my applications double-buffered a week ago, and I haven't seen any blurred text in any of them since then. Previously, I saw severely blurred text daily. Hence, it seems like this issue - whatever is causing it - can be fixed by making the status bars double buffered.

Size Class Issues - Also need a size class key

In Xcode I am having an issue with the size classes in my app. I am unable to get the right size classes to show that seem to work for all of my different devices. I kind of would like a key to see what the size classes should really be, also the size classes don't seem to really match up.
Below is an image attached of an example. I can't get anything correct. I am new to this and I know that I am doing something wrong.
Also, I tried this: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LayoutandAppearance.html but it didn't match up. Maybe my controls have a layout issue?
Edit: Shown below, I can't modify the leading edges and trailing edges...
Whoo Hooo!!! I figured it out!!! #nburk, I want to give you some credit too. You said the key words trailing space and leading space so I googled more on that, and I was seeing the wrong thing.
I want to recommend this to all users who are having problems with it. I didn't realize that dragging the constraints using the control button would actually do it.
https://www.youtube.com/watch?v=IwSTXY0awng
Bill.

Trouble with selection.datum()

I am following this example of a difference chart. I've added buttons on my page that make ajax calls to fetch new datasets, and then I redraw the difference charts. There are several difference charts on my page.
Upon redrawing, the rendering of the above/below areas becomes corrupted: x-values have both above and below areas rendered. I'm fairly certain it's not a back-end problem, because the initial load produces a correct chart; changing a parameter messes up the redrawn chart; and going back to the default parameters and redrawing the original chart also produces a corrupted chart. In fact, I can partially make out what's happening: the original time series is present on the new graph. It's almost as if there are three series being graphed.
I think it has to do with .datum. I don't fully understand how it works, since it differs from the standard enter/update/exit methods associated with .data. I've read the documentation, but am still confused. Some possibilities:
The original data is hanging around (even though I clean out the container with $('#chart').html(''))
The .append(g) is adding groups without removing the earlier ones.
The svg.append("clipPath").attr("id", "clip-below") is causing problems, since multiple nodes have the same id (even though again, I'm not sure how this could happen since I remove the nodes before the redraw).
I feel like I'm missing a lot of fundamentals here, even though I've spent a decent amount of time trying to understand the library. Can anyone see anything obvious, or point out some good resources for me to look at?
UPDATE: This has to do with there being two charts on the page. I noticed this when I opened the inspector and closed it. The areas of the bottom chart (the difference chart) had screwed up, and I noticed the new line that it was using to separate the above-area from the below-area looked a lot like one of the lines from the top chart.
Does anybody have experience with dependency issues/namespace collisions when drawing two charts on the same page?
The problem was, the id's for the clipping paths were the same.
I would still like some more resources concerning .datum.

Image become scrambled at a certain size inside NSImageWell

I got an exceedingly strange problem. I have a SidebarDocumentsIcon.icns file (the same one used by finder) that I load into an NSImageWell. However, at certain critical sizes(width between 17-18 pixels) my image becomes completely scrambled in both the interface builder and the compiled app. This only happens to certain images for some reason, and never used to happen before. I tried to restore my repository, made sure that every byte is in the right place, but still this annoying bug keeps on happening. Has anybody here experienced this problem before? Any tips on solving it?

Java3D: Very poor performance in applet on MacOS X

I'm trying to do some animations using Java3D on a Mac.
If I use universe = new SimpleUniverse(); to create a universe, everything is fast. The problem is that there's a bit of tearing sometimes because I'm altering object properties while in the middle of rendering. What I would like to do is stop the rendering while I'm updating properties.
My first step was to try creating my own Canvas3D, and that's where things went wrong. Rather than just creating a SimpleUniverse, I do this sort of thing:
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
universe = SimpleUniverse(canvas);
When I do this, the first problem is that the window doesn't automatically appear. So based on the example at java2s, I embedded the Canvas3D in an applet. Then I get a window, but performance is TERRIBLE. The rendering is MUCH slower.
It's almost as though the rendering is no longer being done by the graphics engine but instead in software.
Can anyone give me some tips as to what I'm doing wrong here?
Thanks!
You should try compiling your BranchGroups before they become live. This helps preprocess the objects before they get displayed in the universe. It might also be something else that java is getting hung up on, if you put the whole source in the question, then i could tell you more. It might also just be your computer, Java3D takes a big hunk of Memory and is pretty CPU intensive, your computer specs would also be relevant in answering this question
Hope that helped you out a little bit, if you add more to your question i would be happy to help you more

Resources