window resize performance tuning

* only call refreshUI if space change is enough
* added FIXME for pane.setPrefWidth under windows, other parts that are affected see issue main.1
This commit is contained in:
Jannik 2017-09-13 23:57:29 +02:00
parent 3f98dfa059
commit 3bc571bacd
4 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@ -86,7 +86,7 @@ public class Main extends Application {
gamesDBFile = new File(dirWin + "/games.db");
localDB = new File(dirWin+"/localRoms.db");
pictureCache= new File(dirWin+"/picture_cache");
pane.setPrefWidth(892);
pane.setPrefWidth(892); //FIXME this is not working under Windows anymore, need to test which size is correct. see issue #main.1
}
//startup checks
@ -193,8 +193,19 @@ public class Main extends Application {
final ChangeListener<Number> listener = new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
mainWindowController.refreshUIData();
int xPosHelperMax;
//TODO see issue #main.1
if(System.getProperty("os.name").equals("Linux")){
xPosHelperMax = (int) Math.floor((pane.getPrefWidth() - 36) / 217);
} else {
xPosHelperMax = (int) Math.floor((pane.getPrefWidth() - 24) / 217);
}
mainWindowController.refreshplayBtnPosition();
//call only if there is enough space for a new row TODO test this!
if (mainWindowController.getxPosHelper() != xPosHelperMax) {
mainWindowController.refreshUIData();
}
// mainWindowController.refreshUIData();
//TODO saveSettings only on left mouseBtn release
mainWindowController.saveSettings();
}

View File

@ -1201,6 +1201,7 @@ public class MainWindowController {
*/
private void generatePosition() {
int xPosHelperMax;
//TODO see issue #main.1
if(System.getProperty("os.name").equals("Linux")){
xPosHelperMax = (int) Math.floor((main.pane.getPrefWidth() - 36) / 217);
} else {