On Mon, 26 Apr 2021 21:06:41 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Well, it's complicated. The algorithm that calculates the required space for 
>> the tick labels does not take into account the tick label rotation. I did 
>> not look into adding this at this time because that opens up a lot of other 
>> potential pathways that seem broader in scope. With these changes, if the 
>> application detects that there is not enough space to display the text at 
>> the current rotation (which is assumed to be either 90 or 0 degrees), we 
>> rotate it by 90 degrees and remeasure. If that second remeasuring shows that 
>> the tick labels can be fully displayed at that rotation, the tick label 
>> rotation is overwritten to either 0 or 90 degrees. Theoretically if a user 
>> defines a set tick label rotation, it can be overwritten under these 
>> circumstances. However, I think this is reasonable given that when 
>> `autoRanging` is disabled a number of other properties are also overwritten 
>> in a similar manner.
>
> Yeah, it is complicated, and I agree doesn't work entirely correctly today, 
> but this change breaks setting the axis tick label rotation completely, even 
> in case where will fit without forcing the rotation to 90.
> 
> To reproduce this problem, run the Ensemble8 app with your fix, select the 
> Bar Chart sample, and attempt to change the X axis `tickLabelRotation`, 
> either using the slider or entering a number in the text field. You will be 
> unable to change the value since the code you added will overwrite it.
> 
> If you run it without your fix, you can change the X axis 
> `tickLabelRotation`. It won't take effect right away (that's a bug), but if 
> you uncheck and then recheck `tickLabelsVisible` it will re-layout the chart 
> and the axis labels will be drawn rotated.
> 
> With auto-ranging selected, if you run with your fix, you can change the 
> axis, but it won't actually do anything, even in the case where the label 
> fits.
> 
> Without your fix, you can rotate the labels with the slider just fine.
> 
> So while I agree that improving the situation when a rotation is set could be 
> done as a follow-up bug, we need a solution that won't break existing use 
> cases that are working.

@kevinrushforth Thank you for pointing this out, I was not aware of the 
Ensemble8 app that provided a testbed for this functionality. I will dig into 
this again and figure out a better solution. 

On a somewhat unrelated note to this PR, are there any instructions for how to 
get the JavaFX repository set up in an IDE? I have had a terrible time dealing 
with compile warnings in my IntelliJ IDE even though I can run everything 
successfully through Gradle on the command line.

-------------

PR: https://git.openjdk.java.net/jfx/pull/342

Reply via email to