[FEAT] migrate to 22D mode in GUI instead of 3D that is not usefull and easy to use

This commit is contained in:
Edouard DUPIN 2025-07-10 17:56:02 +02:00
parent 9472ddc46b
commit a81778e4aa
47 changed files with 1228 additions and 1237 deletions

View File

@ -72,7 +72,7 @@
<sourceDirectory>src/main</sourceDirectory> <sourceDirectory>src/main</sourceDirectory>
<resources> <resources>
<resource> <resource>
<directory>${basedir}/src/resources</directory> <directory>src/resources</directory>
</resource> </resource>
</resources> </resources>
<plugins> <plugins>

View File

@ -62,15 +62,15 @@ public class BasicWindows extends Windows {
setPropertyTitle("No title set !!! for this test"); setPropertyTitle("No title set !!! for this test");
final Sizer sizerMain = new Sizer(DisplayMode.HORIZONTAL); final Sizer sizerMain = new Sizer(DisplayMode.HORIZONTAL);
sizerMain.setPropertyExpand(Vector3b.TRUE); sizerMain.setPropertyExpand(Vector2b.TRUE);
sizerMain.setPropertyFill(Vector3b.TRUE); sizerMain.setPropertyFill(Vector2b.TRUE);
setSubWidget(sizerMain); setSubWidget(sizerMain);
this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL); this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL);
this.sizerMenuRoot.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE); this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE);
this.sizerMenuRoot.setPropertyLockExpand(Vector3b.TRUE); this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE);
this.sizerMenuRoot.setPropertyFill(Vector3b.TRUE); this.sizerMenuRoot.setPropertyFill(Vector2b.TRUE);
this.sizerMenuRoot.setPropertyMinSize(new Dimension3f(new Vector3f(350, 10, 10), Distance.PIXEL)); this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
this.sizerMenuRoot.setPropertyGravity(Gravity.TOP); this.sizerMenuRoot.setPropertyGravity(Gravity.TOP);
sizerMain.subWidgetAdd(this.sizerMenuRoot); sizerMain.subWidgetAdd(this.sizerMenuRoot);
@ -79,42 +79,42 @@ public class BasicWindows extends Windows {
next.signalClick.connectAuto(this, BasicWindows::staticRequestNext); next.signalClick.connectAuto(this, BasicWindows::staticRequestNext);
this.sizerMenu = new Sizer(DisplayMode.VERTICAL); this.sizerMenu = new Sizer(DisplayMode.VERTICAL);
this.sizerMenu.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE); this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE);
this.sizerMenu.setPropertyLockExpand(Vector3b.TRUE); this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE);
this.sizerMenu.setPropertyFill(Vector3b.TRUE); this.sizerMenu.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.setPropertyMinSize(new Dimension3f(new Vector3f(350, 10, 10), Distance.PIXEL)); this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
this.sizerMenu.setPropertyGravity(Gravity.TOP); this.sizerMenu.setPropertyGravity(Gravity.TOP);
this.sizerMenuRoot.subWidgetAdd(this.sizerMenu); this.sizerMenuRoot.subWidgetAdd(this.sizerMenu);
final Sizer sizerVertMain = new Sizer(DisplayMode.VERTICAL); final Sizer sizerVertMain = new Sizer(DisplayMode.VERTICAL);
sizerVertMain.setPropertyExpand(Vector3b.TRUE); sizerVertMain.setPropertyExpand(Vector2b.TRUE);
sizerVertMain.setPropertyFill(Vector3b.TRUE); sizerVertMain.setPropertyFill(Vector2b.TRUE);
sizerMain.subWidgetAdd(sizerVertMain); sizerMain.subWidgetAdd(sizerVertMain);
{ {
final Spacer simpleSpacer = new Spacer(); final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_128, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL));
simpleSpacer.setPropertyColor(Color.ALICE_BLUE); simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE);
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
sizerVertMain.subWidgetAdd(simpleSpacer); sizerVertMain.subWidgetAdd(simpleSpacer);
} }
this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL); this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL);
this.sizerTestAreaHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE);
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector3b.TRUE); this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE);
this.sizerTestAreaHori.setPropertyFill(Vector3b.TRUE_FALSE_FALSE); this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE);
sizerVertMain.subWidgetAdd(this.sizerTestAreaHori); sizerVertMain.subWidgetAdd(this.sizerTestAreaHori);
{ {
final Spacer simpleSpacer = new Spacer(); final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.DARK_GREEN); simpleSpacer.setPropertyColor(Color.DARK_GREEN);
simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE);
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
sizerVertMain.subWidgetAdd(simpleSpacer); sizerVertMain.subWidgetAdd(simpleSpacer);
} }
} }
@ -133,8 +133,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Boolean value) { if (valueRaw instanceof final Boolean value) {
final CheckBox checkBox = new CheckBox("Y"); final CheckBox checkBox = new CheckBox("Y");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value); checkBox.setPropertyValue(value);
this.sizerMenu.subWidgetAdd(checkBox); this.sizerMenu.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -161,13 +161,13 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Dimension1f value) { if (valueRaw instanceof final Dimension1f value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size()); spin.setPropertyValue((int) value.size());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -200,20 +200,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Dimension2f value) { if (valueRaw instanceof final Dimension2f value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().x()); spin.setPropertyValue((int) value.size().x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -233,20 +233,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().y()); spin.setPropertyValue((int) value.size().y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -278,20 +278,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Dimension3f value) { if (valueRaw instanceof final Dimension3f value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().x()); spin.setPropertyValue((int) value.size().x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -311,20 +311,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().y()); spin.setPropertyValue((int) value.size().y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -344,20 +344,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Z"); final Label simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().z()); spin.setPropertyValue((int) value.size().z());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -388,8 +388,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Double value) { if (valueRaw instanceof final Double value) {
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) (double) value); spin.setPropertyValue((int) (double) value);
this.sizerMenu.subWidgetAdd(spin); this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -415,8 +415,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Float value) { if (valueRaw instanceof final Float value) {
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) (float) value); spin.setPropertyValue((int) (float) value);
this.sizerMenu.subWidgetAdd(spin); this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -442,9 +442,9 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Gravity value) { if (valueRaw instanceof final Gravity value) {
final Button buttonGravity = Button.createLabelButton("Gravity"); final Button buttonGravity = Button.createLabelButton("Gravity");
buttonGravity.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); buttonGravity.setPropertyExpand(Vector2b.TRUE_FALSE);
buttonGravity.setPropertyFill(Vector3b.TRUE); buttonGravity.setPropertyFill(Vector2b.TRUE);
buttonGravity.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); buttonGravity.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
buttonGravity.setPropertyGravity(Gravity.CENTER); buttonGravity.setPropertyGravity(Gravity.CENTER);
this.sizerMenu.subWidgetAdd(buttonGravity); this.sizerMenu.subWidgetAdd(buttonGravity);
final Label gravLabel = (Label) (buttonGravity.getSubWidget()); final Label gravLabel = (Label) (buttonGravity.getSubWidget());
@ -500,8 +500,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Integer value) { if (valueRaw instanceof final Integer value) {
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value); spin.setPropertyValue(value);
this.sizerMenu.subWidgetAdd(spin); this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -528,8 +528,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Long value) { if (valueRaw instanceof final Long value) {
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value); spin.setPropertyValue(value);
this.sizerMenu.subWidgetAdd(spin); this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -555,8 +555,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final String value) { if (valueRaw instanceof final String value) {
final Entry element = new Entry(); final Entry element = new Entry();
element.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); element.setPropertyExpand(Vector2b.TRUE_FALSE);
element.setPropertyFill(Vector3b.TRUE); element.setPropertyFill(Vector2b.TRUE);
element.setPropertyValue(value); element.setPropertyValue(value);
this.sizerMenu.subWidgetAdd(element); this.sizerMenu.subWidgetAdd(element);
final Connection con = element.signalModify.connect(valueButton -> { final Connection con = element.signalModify.connect(valueButton -> {
@ -582,8 +582,8 @@ public class BasicWindows extends Windows {
} }
if (valueRaw instanceof final Uri value) { if (valueRaw instanceof final Uri value) {
final Entry element = new Entry(); final Entry element = new Entry();
element.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); element.setPropertyExpand(Vector2b.TRUE_FALSE);
element.setPropertyFill(Vector3b.TRUE); element.setPropertyFill(Vector2b.TRUE);
element.setPropertyValue(value.toString()); element.setPropertyValue(value.toString());
this.sizerMenu.subWidgetAdd(element); this.sizerMenu.subWidgetAdd(element);
final Connection con = element.signalModify.connect(valueButton -> { final Connection con = element.signalModify.connect(valueButton -> {
@ -609,13 +609,13 @@ public class BasicWindows extends Windows {
return; return;
} }
if (valueRaw instanceof final Vector3b value) { if (valueRaw instanceof final Vector3b value) {
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
{ {
final CheckBox checkBox = new CheckBox("X"); final CheckBox checkBox = new CheckBox("X");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value.x()); checkBox.setPropertyValue(value.x());
lineSizer.subWidgetAdd(checkBox); lineSizer.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -634,8 +634,8 @@ public class BasicWindows extends Windows {
} }
{ {
final CheckBox checkBox = new CheckBox("Y"); final CheckBox checkBox = new CheckBox("Y");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value.y()); checkBox.setPropertyValue(value.y());
lineSizer.subWidgetAdd(checkBox); lineSizer.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -666,20 +666,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Vector2f value) { if (valueRaw instanceof final Vector2f value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.x()); spin.setPropertyValue((int) value.x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -698,20 +698,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.y()); spin.setPropertyValue((int) value.y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -742,20 +742,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Vector2i value) { if (valueRaw instanceof final Vector2i value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value.x()); spin.setPropertyValue(value.x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -774,20 +774,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value.y()); spin.setPropertyValue(value.y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -817,13 +817,13 @@ public class BasicWindows extends Windows {
return; return;
} }
if (valueRaw instanceof final Vector3b value) { if (valueRaw instanceof final Vector3b value) {
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
{ {
final CheckBox checkBox = new CheckBox("X"); final CheckBox checkBox = new CheckBox("X");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value.x()); checkBox.setPropertyValue(value.x());
lineSizer.subWidgetAdd(checkBox); lineSizer.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -842,8 +842,8 @@ public class BasicWindows extends Windows {
} }
{ {
final CheckBox checkBox = new CheckBox("Y"); final CheckBox checkBox = new CheckBox("Y");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value.y()); checkBox.setPropertyValue(value.y());
lineSizer.subWidgetAdd(checkBox); lineSizer.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -861,8 +861,8 @@ public class BasicWindows extends Windows {
} }
{ {
final CheckBox checkBox = new CheckBox("Z"); final CheckBox checkBox = new CheckBox("Z");
checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); checkBox.setPropertyExpand(Vector2b.TRUE_FALSE);
checkBox.setPropertyFill(Vector3b.TRUE); checkBox.setPropertyFill(Vector2b.TRUE);
checkBox.setPropertyValue(value.z()); checkBox.setPropertyValue(value.z());
lineSizer.subWidgetAdd(checkBox); lineSizer.subWidgetAdd(checkBox);
final Connection con = checkBox.signalValue.connect(valueButton -> { final Connection con = checkBox.signalValue.connect(valueButton -> {
@ -893,20 +893,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Vector3f value) { if (valueRaw instanceof final Vector3f value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.x()); spin.setPropertyValue((int) value.x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -925,20 +925,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.y()); spin.setPropertyValue((int) value.y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -957,20 +957,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Z"); final Label simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.z()); spin.setPropertyValue((int) value.z());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -1001,20 +1001,20 @@ public class BasicWindows extends Windows {
if (valueRaw instanceof final Vector3i value) { if (valueRaw instanceof final Vector3i value) {
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("X"); final Label simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value.x()); spin.setPropertyValue(value.x());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -1033,20 +1033,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Y"); final Label simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value.y()); spin.setPropertyValue(value.y());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -1065,20 +1065,20 @@ public class BasicWindows extends Windows {
} }
{ {
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector3b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final Label simpleLabel = new Label("Z"); final Label simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector3b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final Spin spin = new Spin(); final Spin spin = new Spin();
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector3b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue(value.z()); spin.setPropertyValue(value.z());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect(valueButton -> { final Connection con = spin.signalValue.connect(valueButton -> {
@ -1192,9 +1192,9 @@ public class BasicWindows extends Windows {
} }
{ {
final Label simpleLabel = new Label("<b>" + propertyName + ":</b>"); final Label simpleLabel = new Label("<b>" + propertyName + ":</b>");
simpleLabel.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); simpleLabel.setPropertyExpand(Vector2b.TRUE_FALSE);
simpleLabel.setPropertyFill(Vector3b.FALSE); simpleLabel.setPropertyFill(Vector2b.FALSE);
simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
this.sizerMenu.subWidgetAdd(simpleLabel); this.sizerMenu.subWidgetAdd(simpleLabel);
} }
@ -1219,10 +1219,10 @@ public class BasicWindows extends Windows {
{ {
final Spacer simpleSpacer = new Spacer(); final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.CHOCOLATE); simpleSpacer.setPropertyColor(Color.CHOCOLATE);
simpleSpacer.setPropertyExpand(Vector3b.FALSE); simpleSpacer.setPropertyExpand(Vector2b.FALSE);
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); this.sizerTestAreaHori.subWidgetAdd(simpleSpacer);
} }
this.testWidget = widget; this.testWidget = widget;
@ -1230,10 +1230,10 @@ public class BasicWindows extends Windows {
{ {
final Spacer simpleSpacer = new Spacer(); final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW); simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
simpleSpacer.setPropertyExpand(Vector3b.FALSE); simpleSpacer.setPropertyExpand(Vector2b.FALSE);
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); this.sizerTestAreaHori.subWidgetAdd(simpleSpacer);
} }
// update properties... // update properties...

View File

@ -1,10 +1,10 @@
package sample.atriasoft.ewol.ComplexWindiows1; package sample.atriasoft.ewol.ComplexWindiows1;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance; import org.atriasoft.etk.Distance;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.widget.Sizer; import org.atriasoft.ewol.widget.Sizer;
import org.atriasoft.ewol.widget.Sizer.DisplayMode; import org.atriasoft.ewol.widget.Sizer.DisplayMode;
import org.atriasoft.ewol.widget.Spacer; import org.atriasoft.ewol.widget.Spacer;
@ -17,54 +17,54 @@ public class MainWindows extends Windows {
setPropertyTitle("Simple sample test"); setPropertyTitle("Simple sample test");
//EwolObject.getContext().getFontDefault().setName("FreeSans"); //EwolObject.getContext().getFontDefault().setName("FreeSans");
Sizer sizerMain = new Sizer(DisplayMode.VERTICAL); Sizer sizerMain = new Sizer(DisplayMode.VERTICAL);
sizerMain.setPropertyExpand(Vector3b.TRUE); sizerMain.setPropertyExpand(Vector2b.TRUE);
sizerMain.setPropertyFill(Vector3b.TRUE); sizerMain.setPropertyFill(Vector2b.TRUE);
setSubWidget(sizerMain); setSubWidget(sizerMain);
Sizer sizerHori1 = new Sizer(DisplayMode.HORIZONTAL); Sizer sizerHori1 = new Sizer(DisplayMode.HORIZONTAL);
sizerHori1.setPropertyExpand(Vector3b.TRUE); sizerHori1.setPropertyExpand(Vector2b.TRUE);
sizerHori1.setPropertyFill(Vector3b.TRUE); sizerHori1.setPropertyFill(Vector2b.TRUE);
sizerMain.subWidgetAdd(sizerHori1); sizerMain.subWidgetAdd(sizerHori1);
Sizer sizerHori2 = new Sizer(DisplayMode.HORIZONTAL); Sizer sizerHori2 = new Sizer(DisplayMode.HORIZONTAL);
sizerHori2.setPropertyExpand(Vector3b.TRUE); sizerHori2.setPropertyExpand(Vector2b.TRUE);
sizerHori2.setPropertyFill(Vector3b.TRUE); sizerHori2.setPropertyFill(Vector2b.TRUE);
sizerMain.subWidgetAdd(sizerHori2); sizerMain.subWidgetAdd(sizerHori2);
{ {
Spacer simpleSpacer = new Spacer(); Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyMinSize(new Dimension3f(new Vector3f(100, 100, 100), Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(new Vector2f(100, 100), Distance.PIXEL));
simpleSpacer.setPropertyColor(Color.ALICE_BLUE); simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
sizerHori1.subWidgetAdd(simpleSpacer); sizerHori1.subWidgetAdd(simpleSpacer);
} }
{ {
Spacer simpleSpacer = new Spacer(); Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.DARK_GREEN); simpleSpacer.setPropertyColor(Color.DARK_GREEN);
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
sizerHori1.subWidgetAdd(simpleSpacer); sizerHori1.subWidgetAdd(simpleSpacer);
} }
{ {
Spacer simpleSpacer = new Spacer(); Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.CHOCOLATE); simpleSpacer.setPropertyColor(Color.CHOCOLATE);
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
sizerHori1.subWidgetAdd(simpleSpacer); sizerHori1.subWidgetAdd(simpleSpacer);
} }
{ {
Spacer simpleSpacer = new Spacer(); Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW); simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
sizerHori2.subWidgetAdd(simpleSpacer); sizerHori2.subWidgetAdd(simpleSpacer);
} }
{ {
Spacer simpleSpacer = new Spacer(); Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.PINK); simpleSpacer.setPropertyColor(Color.PINK);
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
sizerHori2.subWidgetAdd(simpleSpacer); sizerHori2.subWidgetAdd(simpleSpacer);
} }
} }

View File

@ -1,6 +1,6 @@
package sample.atriasoft.ewol.simpleWindowsLabel; package sample.atriasoft.ewol.simpleWindowsLabel;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.widget.Label; import org.atriasoft.ewol.widget.Label;
import org.atriasoft.ewol.widget.Spacer; import org.atriasoft.ewol.widget.Spacer;
@ -17,14 +17,14 @@ public class MainWindows extends BasicWindows {
//! [ewol_sample_HW_windows_title] //! [ewol_sample_HW_windows_title]
final Label simpleLabel = new Label(); final Label simpleLabel = new Label();
simpleLabel.setPropertyValue("He<b>llo.</b> <font color='blue'>World</font><br/><br/> - How are You ???<br/> - Not so Well, I break my leg.<br/><br/><center>The end</center>"); simpleLabel.setPropertyValue("He<b>llo.</b> <font color='blue'>World</font><br/><br/> - How are You ???<br/> - Not so Well, I break my leg.<br/><br/><center>The end</center>");
simpleLabel.setPropertyExpand(Vector3b.TRUE); simpleLabel.setPropertyExpand(Vector2b.TRUE);
simpleLabel.setPropertyFill(Vector3b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
this.setTestWidget(simpleLabel); this.setTestWidget(simpleLabel);
//! [ewol_sample_HW_windows_label] //! [ewol_sample_HW_windows_label]
} else { } else {
final Spacer simpleSpacer = new Spacer(); final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyExpand(Vector3b.TRUE); simpleSpacer.setPropertyExpand(Vector2b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE); simpleSpacer.setPropertyFill(Vector2b.TRUE);
this.setTestWidget(simpleSpacer); this.setTestWidget(simpleSpacer);
} }
} }

View File

@ -3,18 +3,15 @@ package sample.atriasoft.ewol.simpleWindowsWithBox;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Dimension3f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.widget.Box; import org.atriasoft.ewol.widget.Box;
import org.atriasoft.ewol.widget.Box2;
import sample.atriasoft.ewol.BasicWindows; import sample.atriasoft.ewol.BasicWindows;
public class MainWindows extends BasicWindows { public class MainWindows extends BasicWindows {
Box2 testWidget; Box testWidget;
public MainWindows() { public MainWindows() {
//! [ewol_sample_HW_windows_title] //! [ewol_sample_HW_windows_title]
@ -22,15 +19,15 @@ public class MainWindows extends BasicWindows {
final Box innerWidget = new Box(); final Box innerWidget = new Box();
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
innerWidget.setPropertyExpand(Vector3b.FALSE); innerWidget.setPropertyExpand(Vector2b.FALSE);
innerWidget.setPropertyExpandIfFree(Vector3b.TRUE); innerWidget.setPropertyExpandIfFree(Vector2b.TRUE);
innerWidget.setPropertyFill(Vector3b.TRUE); innerWidget.setPropertyFill(Vector2b.TRUE);
innerWidget.setPropertyColor(Color.PINK); innerWidget.setPropertyColor(Color.PINK);
innerWidget.setPropertyMinSize(new Dimension3f(new Vector3f(50, 80, 15))); innerWidget.setPropertyMinSize(new Dimension2f(new Vector2f(50, 80)));
this.testWidget = new Box2(innerWidget); this.testWidget = new Box(innerWidget);
this.testWidget.setPropertyExpand(Vector3b.FALSE); this.testWidget.setPropertyExpand(Vector2b.FALSE);
this.testWidget.setPropertyFill(Vector3b.FALSE); this.testWidget.setPropertyFill(Vector2b.FALSE);
this.testWidget.setPropertyBorderWidth(new Dimension1f(10)); this.testWidget.setPropertyBorderWidth(new Dimension1f(10));
this.testWidget.setPropertyBorderRadius(new Dimension1f(25)); this.testWidget.setPropertyBorderRadius(new Dimension1f(25));
this.testWidget.setPropertyBorderColor(Color.BLACK); this.testWidget.setPropertyBorderColor(Color.BLACK);

View File

@ -14,8 +14,8 @@ public class MainWindows extends BasicWindows {
setPropertyTitle("Simple Button"); setPropertyTitle("Simple Button");
this.testWidget = Button.createLabelButton("A simple Label"); this.testWidget = Button.createLabelButton("A simple Label");
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
// this.testWidget.setPropertyExpand(Vector3b.TRUE); // this.testWidget.setPropertyExpand(Vector2b.TRUE);
// this.testWidget.setPropertyFill(Vector3b.TRUE); // this.testWidget.setPropertyFill(Vector2b.TRUE);
// this.testWidget.setPropertyBorderWidth(new Dimension1f(10)); // this.testWidget.setPropertyBorderWidth(new Dimension1f(10));
// this.testWidget.setPropertyBorderRadius(new Dimension1f(25)); // this.testWidget.setPropertyBorderRadius(new Dimension1f(25));
// this.testWidget.setPropertyBorderColor(Color.BLACK); // this.testWidget.setPropertyBorderColor(Color.BLACK);

View File

@ -1,6 +1,6 @@
package sample.atriasoft.ewol.simpleWindowsWithCheckBox; package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.widget.CheckBox; import org.atriasoft.ewol.widget.CheckBox;
import sample.atriasoft.ewol.BasicWindows; import sample.atriasoft.ewol.BasicWindows;
@ -15,14 +15,14 @@ public class MainWindows extends BasicWindows {
this.testWidget = new CheckBox("<b>Hello, how Are</b> You?<br/>second-life?"); this.testWidget = new CheckBox("<b>Hello, how Are</b> You?<br/>second-life?");
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
this.testWidget.setPropertyExpand(Vector3b.TRUE); this.testWidget.setPropertyExpand(Vector2b.TRUE);
this.testWidget.setPropertyFill(Vector3b.TRUE); this.testWidget.setPropertyFill(Vector2b.TRUE);
setTestWidget(this.testWidget); setTestWidget(this.testWidget);
/* /*
Button simpleButton = new Button(); Button simpleButton = new Button();
simpleButton.setPropertyValue("Top Button"); simpleButton.setPropertyValue("Top Button");
simpleButton.setPropertyExpand(Vector3b.TRUE); simpleButton.setPropertyExpand(Vector2b.TRUE);
simpleButton.setPropertyFill(Vector3b.TRUE); simpleButton.setPropertyFill(Vector2b.TRUE);
this.setTestWidget(simpleButton); this.setTestWidget(simpleButton);
*/ */
} }

View File

@ -1,10 +1,10 @@
package sample.atriasoft.ewol.simpleWindowsWithImage; package sample.atriasoft.ewol.simpleWindowsWithImage;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance; import org.atriasoft.etk.Distance;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.widget.Button; import org.atriasoft.ewol.widget.Button;
import org.atriasoft.ewol.widget.ImageDisplay; import org.atriasoft.ewol.widget.ImageDisplay;
@ -35,22 +35,22 @@ public class MainWindows extends BasicWindows {
this.testWidget = new ImageDisplay(); this.testWidget = new ImageDisplay();
this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
this.testWidget.setPropertyExpand(Vector3b.TRUE); this.testWidget.setPropertyExpand(Vector2b.TRUE);
this.testWidget.setPropertyFill(Vector3b.TRUE); this.testWidget.setPropertyFill(Vector2b.TRUE);
this.testWidget.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); this.testWidget.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
setTestWidget(this.testWidget); setTestWidget(this.testWidget);
{ {
// final Button button = Button.createToggleLabelButton("mireA.png", "mireC.png"); // final Button button = Button.createToggleLabelButton("mireA.png", "mireC.png");
// button.setPropertyExpand(Vector3b.FALSE); // button.setPropertyExpand(Vector2b.FALSE);
// button.setPropertyFill(Vector3b.FALSE); // button.setPropertyFill(Vector2b.FALSE);
// button.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); // button.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
// this.addButton(button); // this.addButton(button);
// button.signalValue.connectAuto(this, MainWindows::eventButtonChangeImage); // button.signalValue.connectAuto(this, MainWindows::eventButtonChangeImage);
} }
this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio"); this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio");
this.buttonAspectRatio.setPropertyExpand(Vector3b.FALSE); this.buttonAspectRatio.setPropertyExpand(Vector2b.FALSE);
this.buttonAspectRatio.setPropertyFill(Vector3b.FALSE); this.buttonAspectRatio.setPropertyFill(Vector2b.FALSE);
this.buttonAspectRatio.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); this.buttonAspectRatio.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
addButton(this.buttonAspectRatio); addButton(this.buttonAspectRatio);
this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio); this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio);
} }

View File

@ -1,7 +1,7 @@
package org.atriasoft.ewol; package org.atriasoft.ewol;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
/** /**
* @file * @file
@ -37,24 +37,24 @@ import org.atriasoft.etk.math.Vector3i;
*/ */
//@formatter:on //@formatter:on
public record DrawProperty( public record DrawProperty(
Vector3i windowsSize, // !< Windows complete size Vector2i windowsSize, // !< Windows complete size
Vector3i origin, // !< Windows clipping upper widget (can not be <0) Vector2i origin, // !< Windows clipping upper widget (can not be <0)
Vector3i size// !< Windows clipping upper widget (can not be <0 and >this.windowsSize) Vector2i size// !< Windows clipping upper widget (can not be <0 and >this.windowsSize)
) { ) {
public DrawProperty() { public DrawProperty() {
this(Vector3i.ZERO, Vector3i.ZERO, Vector3i.ZERO); this(Vector2i.ZERO, Vector2i.ZERO, Vector2i.ZERO);
} }
public DrawProperty(final Vector3i windowsSize, final Vector3i origin, final Vector3i size) { public DrawProperty(final Vector2i windowsSize, final Vector2i origin, final Vector2i size) {
this.windowsSize = windowsSize; this.windowsSize = windowsSize;
this.origin = origin; this.origin = origin;
this.size = size; this.size = size;
} }
public DrawProperty withLimit(final Vector3f originIn, final Vector3f size) { public DrawProperty withLimit(final Vector2f originIn, final Vector2f size) {
Vector3i tmpSize = this.size.add(this.origin); Vector2i tmpSize = this.size.add(this.origin);
Vector3i origin = this.origin.max((int) originIn.x(), (int) originIn.y(), (int) originIn.z()); Vector2i origin = this.origin.max((int) originIn.x(), (int) originIn.y());
tmpSize = tmpSize.min((int) (originIn.x() + size.x()), (int) (originIn.y() + size.y()), (int) (originIn.z() + size.z())); tmpSize = tmpSize.min((int) (originIn.x() + size.x()), (int) (originIn.y() + size.y()));
tmpSize = tmpSize.less(origin); tmpSize = tmpSize.less(origin);
return new DrawProperty(this.windowsSize, origin, tmpSize); return new DrawProperty(this.windowsSize, origin, tmpSize);
} }

View File

@ -5,7 +5,7 @@
*/ */
package org.atriasoft.ewol; package org.atriasoft.ewol;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
/** /**
* Gravity of the widget property * Gravity of the widget property
@ -25,7 +25,7 @@ public record Gravity(
public static final Gravity TOP_LEFT = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-right public static final Gravity TOP_LEFT = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-right
public static final Gravity TOP_RIGHT = new Gravity(GravityHorizontal.RIGHT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-left public static final Gravity TOP_RIGHT = new Gravity(GravityHorizontal.RIGHT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-left
public Vector3f gravityGenerateDelta(final Vector3f deltas) { public Vector2f gravityGenerateDelta(final Vector2f deltas) {
float outX = 0; float outX = 0;
float outY = 0; float outY = 0;
float outZ = 0; float outZ = 0;
@ -47,16 +47,7 @@ public record Gravity(
outY = (int) (deltas.y() * 0.5f); outY = (int) (deltas.y() * 0.5f);
} }
} }
if (deltas.z() > 0.0001f) { return new Vector2f(outX, outY);
if (this.z == GravityDepth.BACK) {
// nothing to do
} else if (this.z == GravityDepth.FRONT) {
outZ = (int) (deltas.z());
} else {
outZ = (int) (deltas.z() * 0.5f);
}
}
return new Vector3f(outX, outY, outZ);
} }
public static Gravity valueOf(String value) { public static Gravity valueOf(String value) {

View File

@ -12,84 +12,65 @@ public record Padding(
float left, float left,
float top, float top,
float right, float right,
float bottom, // !< this represent the 4 padding value Left top right buttom (like css) float bottom) {
float front,
float back) {
public static final Padding ZERO = new Padding(0, 0, 0, 0, 0, 0); public static final Padding ZERO = new Padding(0, 0, 0, 0);
public Padding() { public Padding() {
this(0, 0, 0, 0, 0, 0); this(0, 0, 0, 0);
} }
public Padding(final float left) { public Padding(final float left) {
this(left, 0, 0, 0, 0, 0); this(left, 0, 0, 0);
} }
public Padding(final float left, final float top) { public Padding(final float left, final float top) {
this(left, top, 0, 0, 0, 0); this(left, top, 0, 0);
} }
public Padding(final float left, final float top, final float right) { public Padding(final float left, final float top, final float right) {
this(left, top, right, 0, 0, 0); this(left, top, right, 0);
} }
public Padding(final float left, final float top, final float right, final float bottom) { public Padding(final float left, final float top, final float right, final float bottom) {
this(left, top, right, bottom, 0, 0);
}
public Padding(final double left, final double top, final double right, final double bottom) {
this((float) left, (float) top, (float) right, (float) bottom, 0, 0);
}
public Padding(final float left, final float top, final float right, final float bottom, final float front) {
this(left, top, right, bottom, front, 0);
}
public Padding(final float left, final float top, final float right, final float bottom, final float front, final float back) {
this.left = left; this.left = left;
this.top = top; this.top = top;
this.right = right; this.right = right;
this.bottom = bottom; this.bottom = bottom;
this.front = front;
this.back = back;
} }
public Padding(final double left, final double top, final double right, final double bottom) {
this((float) left, (float) top, (float) right, (float) bottom);
}
/** /**
* Add a vector to this one * Add a vector to this one
* @param v The vector to add to this one * @param v The vector to add to this one
*/ */
public Padding add(final Padding v) { public Padding add(final Padding v) {
return new Padding(this.left + v.left, this.top + v.top, this.right + v.right, this.bottom + v.bottom, this.front + v.front, this.back + v.back); return new Padding(this.left + v.left, this.top + v.top, this.right + v.right, this.bottom + v.bottom);
} }
public Padding withLeft(final float left) { public Padding withLeft(final float left) {
return new Padding(left, this.top, this.right, this.bottom, this.front, this.back); return new Padding(left, this.top, this.right, this.bottom);
} }
public Padding withRight(final float right) { public Padding withRight(final float right) {
return new Padding(this.left, this.top, right, this.bottom, this.front, this.back); return new Padding(this.left, this.top, right, this.bottom);
} }
public Padding withBottom(final float bottom) { public Padding withBottom(final float bottom) {
return new Padding(this.left, this.top, this.right, bottom, this.front, this.back); return new Padding(this.left, this.top, this.right, bottom);
} }
public Padding withTop(final float top) { public Padding withTop(final float top) {
return new Padding(this.left, top, this.right, this.bottom, this.front, this.back); return new Padding(this.left, top, this.right, this.bottom);
}
public Padding withFront(final float front) {
return new Padding(this.left, this.top, this.right, this.bottom, front, this.back);
}
public Padding withBack(final float back) {
return new Padding(this.left, this.top, this.right, this.bottom, this.front, back);
} }
@Override @Override
public String toString() { public String toString() {
return "{" + left() + "," + top() + "," + right() + "," + bottom() + "," + front() + "," + back() + "}"; return "{" + left() + "," + top() + "," + right() + "," + bottom() + "}";
} }
public float x() { public float x() {
@ -99,9 +80,4 @@ public record Padding(
public float y() { public float y() {
return this.top + this.bottom; return this.top + this.bottom;
} }
public float z() {
return this.front + this.back;
}
} }

View File

@ -1,7 +1,7 @@
package org.atriasoft.ewol.compositing; package org.atriasoft.ewol.compositing;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
@ -13,14 +13,14 @@ public abstract class Compositing {
protected Matrix4f matrixApply = Matrix4f.IDENTITY; protected Matrix4f matrixApply = Matrix4f.IDENTITY;
/** /**
* clear alll tre registered element in the current element * clear all the registered element in the current element
*/ */
public void clear() { public void clear() {
this.matrixApply = Matrix4f.IDENTITY; this.matrixApply = Matrix4f.IDENTITY;
} }
/** /**
* Virtal pure function that request the draw of all openGl elements * Virtual pure function that request the draw of all openGl elements
*/ */
public void draw() { public void draw() {
draw(true); draw(true);
@ -29,12 +29,12 @@ public abstract class Compositing {
public abstract void draw(final boolean disableDepthTest); public abstract void draw(final boolean disableDepthTest);
/** /**
* Require the transfer of all the data in the Graphic card (doen between the addinc element and the draw) * Require the transfer of all the data in the Graphic card (does between the adding element and the draw)
*/ */
public abstract void flush(); public abstract void flush();
/** /**
* reset to the eye matrix the openGL mouving system * reset to the eye matrix the openGL moving system
*/ */
public void resetMatrix() { public void resetMatrix() {
this.matrixApply = Matrix4f.IDENTITY; this.matrixApply = Matrix4f.IDENTITY;
@ -44,7 +44,7 @@ public abstract class Compositing {
* rotate the curent display of this element * rotate the curent display of this element
* @param vect The rotation vector to apply at the transformation matrix * @param vect The rotation vector to apply at the transformation matrix
*/ */
public void rotate(final Vector3f vect, final float angle) { public void rotate(final Vector2f vect, final float angle) {
this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixRotate(vect, angle)); this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixRotate(vect, angle));
} }
@ -52,7 +52,7 @@ public abstract class Compositing {
* scale the current diaplsy of this element * scale the current diaplsy of this element
* @param vect The scaling vector to apply at the transformation matrix * @param vect The scaling vector to apply at the transformation matrix
*/ */
public void scale(final Vector3f vect) { public void scale(final Vector2f vect) {
this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixScale(vect)); this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixScale(vect));
} }
@ -68,7 +68,7 @@ public abstract class Compositing {
* translate the current display of this element * translate the current display of this element
* @param vect The translation vector to apply at the transformation matrix * @param vect The translation vector to apply at the transformation matrix
*/ */
public void translate(final Vector3f vect) { public void translate(final Vector2f vect) {
this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixTranslate(vect)); this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixTranslate(vect));
} }
} }

View File

@ -26,8 +26,8 @@ public class CompositingDrawing extends Compositing {
protected static int vboIdColor = 1; protected static int vboIdColor = 1;
protected static int vboIdCoord = 0; protected static int vboIdCoord = 0;
private boolean clippingEnable = false; // !< true if the clipping must be activated private boolean clippingEnable = false; // !< true if the clipping must be activated
private Vector3f clippingPosStart = new Vector3f(0, 0, 0); // !< Clipping start position private Vector3f clippingPosStart = Vector3f.ZERO; // !< Clipping start position
private Vector3f clippingPosStop = new Vector3f(0, 0, 0); // !< Clipping stop position private Vector3f clippingPosStop = Vector3f.ZERO; // !< Clipping stop position
private Color color = Color.BLACK; // !< The text foreground color private Color color = Color.BLACK; // !< The text foreground color
private Color colorBg = Color.NONE; // !< The text background color private Color colorBg = Color.NONE; // !< The text background color
//private int oGLMatrix = -1; // !< openGL id on the element (transformation matrix) //private int oGLMatrix = -1; // !< openGL id on the element (transformation matrix)
@ -265,8 +265,8 @@ public class CompositingDrawing extends Compositing {
} }
/** /**
* Relative drawing a line (spacial vector) * Relative drawing a line (special vector)
* @param vect Vector of the curent line. * @param vect Vector of the current line.
*/ */
public void lineRel(final float xxx, final float yyy) { public void lineRel(final float xxx, final float yyy) {
lineTo(this.position.add(new Vector3f(xxx, yyy, 0))); lineTo(this.position.add(new Vector3f(xxx, yyy, 0)));
@ -555,7 +555,7 @@ public class CompositingDrawing extends Compositing {
/** /**
* Specify the line thickness for the next elements * Specify the line thickness for the next elements
* @param thickness The thickness disired for the next print * @param thickness The thickness desired for the next print
*/ */
public void setThickness(final float thickness) { public void setThickness(final float thickness) {
this.thickness = thickness; this.thickness = thickness;

View File

@ -11,7 +11,6 @@ import java.util.List;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Configs; import org.atriasoft.etk.Configs;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3f;
@ -28,7 +27,8 @@ public class CompositingText extends TextBase {
protected ResourceTexturedFont font; // !< Font resources protected ResourceTexturedFont font; // !< Font resources
protected List<Vector3f> pointPositions = new ArrayList<>(); protected List<Vector3f> pointPositions = new ArrayList<>();
protected float size; protected float size;
// the forceClimp is to generate a forcing of the rendering in small font, this permit to have a correct view of the font, otherwise it will be transparent. // the forceClimp is to generate a forcing of the rendering in small font, this
// permit to have a correct view of the font, otherwise it will be transparent.
protected final boolean forceClimp = true; protected final boolean forceClimp = true;
protected List<Vector2f> texturePositions = new ArrayList<>(); protected List<Vector2f> texturePositions = new ArrayList<>();
@ -46,6 +46,7 @@ public class CompositingText extends TextBase {
/** /**
* generic constructor * generic constructor
*
* @param fontName Name of the font that might be loaded * @param fontName Name of the font that might be loaded
* @param fontSize Size of the font that might be loaded * @param fontSize Size of the font that might be loaded
*/ */
@ -54,27 +55,26 @@ public class CompositingText extends TextBase {
} }
@Override @Override
public Vector3f calculateSizeChar(final Character charcode) { public Vector2f calculateSizeChar(final Character charcode) {
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired; final var renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
// get a pointer on the glyph property : // get a pointer on the glyph property :
final GlyphProperty myGlyphProperty = getGlyphPointer(charcode); final var myGlyphProperty = getGlyphPointer(charcode);
final int fontHeigh = (int) getHeight(); final var fontHeigh = (int) getHeight();
if (myGlyphProperty == null) { if (myGlyphProperty == null) {
if (this.font == null) { if (this.font == null) {
LOGGER.warn("no Glyph... in no font"); LOGGER.warn("no Glyph... in no font");
} else { } else {
LOGGER.warn("no Glyph... in font : " + this.font.getName()); LOGGER.warn("no Glyph... in font : " + this.font.getName());
} }
return new Vector3f(0.2f, fontHeigh, 0); return new Vector2f(0.2f, fontHeigh);
} }
// get the kerning offset : // get the kerning offset :
float kerningOffset = 0; var kerningOffset = 0F;
if (this.kerning) { if (this.kerning) {
kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode); kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
} }
final Vector3f outputSize = new Vector3f((myGlyphProperty.getAdvenceX() + kerningOffset) * renderRatio, final var outputSize = new Vector2f((myGlyphProperty.getAdvenceX() + kerningOffset) * renderRatio, fontHeigh);
(fontHeigh), 0);
// Register the previous character // Register the previous character
this.previousCharcode = charcode; this.previousCharcode = charcode;
return outputSize; return outputSize;
@ -109,8 +109,8 @@ public class CompositingText extends TextBase {
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix(); final var projMatrix = OpenGL.getMatrix();
final Matrix4f camMatrix = OpenGL.getCameraMatrix(); final var camMatrix = OpenGL.getCameraMatrix();
this.oGLprogram.use(); this.oGLprogram.use();
this.vbo.bindForRendering(); this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix); this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix);
@ -146,8 +146,8 @@ public class CompositingText extends TextBase {
OpenGL.enable(OpenGL.Flag.flag_depthTest); OpenGL.enable(OpenGL.Flag.flag_depthTest);
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix(); final var projMatrix = OpenGL.getMatrix();
final Matrix4f camMatrix = OpenGL.getCameraMatrix(); final var camMatrix = OpenGL.getCameraMatrix();
this.oGLprogram.use(); this.oGLprogram.use();
this.vbo.bindForRendering(); this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix); this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix);
@ -195,7 +195,7 @@ public class CompositingText extends TextBase {
LOGGER.warn("no font..."); LOGGER.warn("no font...");
return 10.0f; return 10.0f;
} }
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired; final var renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
return this.font.getHeight(this.mode) * renderRatio; return this.font.getHeight(this.mode) * renderRatio;
} }
@ -205,31 +205,33 @@ public class CompositingText extends TextBase {
LOGGER.warn("no font..."); LOGGER.warn("no font...");
return 1.0f; return 1.0f;
} }
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired; final var renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
return this.font.getFontSize() * renderRatio; return this.font.getFontSize() * renderRatio;
} }
@Override @Override
public void printChar(final Character charcode) { public void printChar(final Character charcode) {
//LOGGER.error("Request printChar : '{}' @pos={}", charcode, this.position); // LOGGER.error("Request printChar : '{}' @pos={}", charcode, this.position);
// get a pointer on the glyph property : // get a pointer on the glyph property :
final GlyphProperty myGlyphProperty = getGlyphPointer(charcode); final var myGlyphProperty = getGlyphPointer(charcode);
if (myGlyphProperty == null) { if (myGlyphProperty == null) {
LOGGER.error(" font does not really existed ..."); LOGGER.error(" font does not really existed ...");
return; return;
} }
// sometime we do net require the correct size to the glyph renderer (due to the fact SVG render is not clear on lower size...) // sometime we do net require the correct size to the glyph renderer (due to the
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired; // fact SVG render is not clear on lower size...)
final var renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
final int fontSize = (int) (getSize() * renderRatio); final var fontSize = (int) (getSize() * renderRatio);
final int fontHeigh = (int) (getHeight() * renderRatio); final var fontHeigh = (int) (getHeight() * renderRatio);
// get the kerning offset : // get the kerning offset :
float kerningOffset = 0; var kerningOffset = 0F;
if (this.kerning) { if (this.kerning) {
kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode) * renderRatio; kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode) * renderRatio;
if (kerningOffset != 0) { if (kerningOffset != 0) {
// LOGGER.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.UVal // LOGGER.debug("Kerning between : '" + this.previousCharcode + "''" +
// myGlyph.UVal
// + "' value : " + kerningOffset); // + "' value : " + kerningOffset);
} }
} }
@ -238,16 +240,16 @@ public class CompositingText extends TextBase {
/* /*
* Bitmap position xA xB yC *------* | | | | yD *------* * Bitmap position xA xB yC *------* | | | | yD *------*
*/ */
float dxA = this.position.x() + myGlyphProperty.getTextureRenderOffset().x() * renderRatio + kerningOffset; var dxA = this.position.x() + myGlyphProperty.getTextureRenderOffset().x() * renderRatio + kerningOffset;
float dxB = dxA + myGlyphProperty.sizeTexture.x() * renderRatio; var dxB = dxA + myGlyphProperty.sizeTexture.x() * renderRatio;
float dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() * renderRatio + fontHeigh var dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() * renderRatio + fontHeigh
- fontSize; - fontSize;
float dyD = dyC - myGlyphProperty.sizeTexture.y() * renderRatio; var dyD = dyC - myGlyphProperty.sizeTexture.y() * renderRatio;
float tuA = myGlyphProperty.texturePosStart.x(); var tuA = myGlyphProperty.texturePosStart.x();
float tuB = tuA + myGlyphProperty.texturePosSize.x(); var tuB = tuA + myGlyphProperty.texturePosSize.x();
float tvC = myGlyphProperty.texturePosStart.y(); var tvC = myGlyphProperty.texturePosStart.y();
float tvD = tvC + myGlyphProperty.texturePosSize.y(); var tvD = tvC + myGlyphProperty.texturePosSize.y();
// Clipping and drawing area // Clipping and drawing area
if (this.clippingEnable && (dxB < this.clippingPosStart.x() || dxA > this.clippingPosStop.x() if (this.clippingEnable && (dxB < this.clippingPosStart.x() || dxA > this.clippingPosStop.x()
@ -256,62 +258,62 @@ public class CompositingText extends TextBase {
} else { } else {
if (this.clippingEnable) { if (this.clippingEnable) {
// generate a positions... // generate a positions...
final float texSizeX = tuB - tuA; final var texSizeX = tuB - tuA;
if (dxA < this.clippingPosStart.x()) { if (dxA < this.clippingPosStart.x()) {
// clip display // clip display
final float drawSize = this.clippingPosStart.x() - dxA; final var drawSize = this.clippingPosStart.x() - dxA;
// update element start display // update element start display
dxA = this.clippingPosStart.x(); dxA = this.clippingPosStart.x();
final float addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x(); final var addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x();
// update texture start X Pos // update texture start X Pos
tuA += addElement; tuA += addElement;
} }
if (dxB > this.clippingPosStop.x()) { if (dxB > this.clippingPosStop.x()) {
// clip display // clip display
final float drawSize = dxB - this.clippingPosStop.x(); final var drawSize = dxB - this.clippingPosStop.x();
// update element start display // update element start display
dxB = this.clippingPosStop.x(); dxB = this.clippingPosStop.x();
final float addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x(); final var addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x();
// update texture start X Pos // update texture start X Pos
tuB -= addElement; tuB -= addElement;
} }
final float texSizeY = tvC - tvD; final var texSizeY = tvC - tvD;
if (dyC > this.clippingPosStop.y()) { if (dyC > this.clippingPosStop.y()) {
// clip display // clip display
final float drawSize = dyC - this.clippingPosStop.y(); final var drawSize = dyC - this.clippingPosStop.y();
// update element start display // update element start display
dyC = this.clippingPosStop.y(); dyC = this.clippingPosStop.y();
final float addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y(); final var addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y();
// update texture start X Pos // update texture start X Pos
tvC -= addElement; tvC -= addElement;
} }
if (dyD < this.clippingPosStart.y()) { if (dyD < this.clippingPosStart.y()) {
// clip display // clip display
final float drawSize = this.clippingPosStart.y() - dyD; final var drawSize = this.clippingPosStart.y() - dyD;
// update element start display // update element start display
dyD = this.clippingPosStart.y(); dyD = this.clippingPosStart.y();
final float addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y(); final var addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y();
// update texture start X Pos // update texture start X Pos
tvD += addElement; tvD += addElement;
} }
} }
if (dxB <= dxA || dyD >= dyC) { if (dxB <= dxA || dyD >= dyC) {
// nothing to do ... // nothing to do ...
} else /* } else if (this.needDisplay) {
* Bitmap position 0------1 | | | | 3------2 /*
*/ * Bitmap position 0------1 | | | | 3------2
if (this.needDisplay) { */
final Vector3f drawPosition0 = new Vector3f((int) dxA, (int) dyC, 0); final var drawPosition0 = new Vector3f((int) dxA, (int) dyC, 0);
final Vector3f drawPosition1 = new Vector3f((int) dxB, (int) dyC, 0); final var drawPosition1 = new Vector3f((int) dxB, (int) dyC, 0);
final Vector3f drawPosition2 = new Vector3f((int) dxB, (int) dyD, 0); final var drawPosition2 = new Vector3f((int) dxB, (int) dyD, 0);
final Vector3f drawPosition3 = new Vector3f((int) dxA, (int) dyD, 0); final var drawPosition3 = new Vector3f((int) dxA, (int) dyD, 0);
/* /*
* texture Position : 0------1 | | | | 3------2 * texture Position : 0------1 | | | | 3------2
*/ */
final Vector2f texturePos0 = new Vector2f(tuA + this.mode.getValue(), tvC); final var texturePos0 = new Vector2f(tuA + this.mode.getValue(), tvC);
final Vector2f texturePos1 = new Vector2f(tuB + this.mode.getValue(), tvC); final var texturePos1 = new Vector2f(tuB + this.mode.getValue(), tvC);
final Vector2f texturePos2 = new Vector2f(tuB + this.mode.getValue(), tvD); final var texturePos2 = new Vector2f(tuB + this.mode.getValue(), tvD);
final Vector2f texturePos3 = new Vector2f(tuA + this.mode.getValue(), tvD); final var texturePos3 = new Vector2f(tuA + this.mode.getValue(), tvD);
// NOTE : Android does not support the Quads elements ... // NOTE : Android does not support the Quads elements ...
/* /*
@ -351,11 +353,13 @@ public class CompositingText extends TextBase {
} }
} }
// move the position : // move the position :
// LOGGER.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() + " // LOGGER.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() +
// "
// kerningOffset=" + kerningOffset); // kerningOffset=" + kerningOffset);
this.position = this.position this.position = this.position
.withX(this.position.x() + myGlyphProperty.getAdvenceX() * renderRatio + kerningOffset); .withX(this.position.x() + myGlyphProperty.getAdvenceX() * renderRatio + kerningOffset);
// LOGGER.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart + " // LOGGER.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart
// + "
// stop=" + this.sizeDisplayStop + " pos=" + this.position); // stop=" + this.sizeDisplayStop + " pos=" + this.position);
// Register the previous character // Register the previous character
this.previousCharcode = charcode; this.previousCharcode = charcode;
@ -367,10 +371,10 @@ public class CompositingText extends TextBase {
return; return;
} }
String fontName = inputFontName; var fontName = inputFontName;
int fontSize = inputFontSize; var fontSize = inputFontSize;
// remove old one // remove old one
final ResourceTexturedFont previousFont = this.font; final var previousFont = this.font;
if (fontSize <= 0) { if (fontSize <= 0) {
fontSize = Configs.getConfigFonts().getSize(); fontSize = Configs.getConfigFonts().getSize();
} }
@ -379,10 +383,8 @@ public class CompositingText extends TextBase {
} }
// if size in under 25, we request upper size: // if size in under 25, we request upper size:
int sizeRequest = 25; var sizeRequest = 25;
if (this.forceClimp) { if (this.forceClimp || fontSize > 25) {
sizeRequest = fontSize;
} else if (fontSize > 25) {
sizeRequest = fontSize; sizeRequest = fontSize;
} }
if (inputFontName.equals(this.currentFontName) && this.currentFontSizeRequired == sizeRequest) { if (inputFontName.equals(this.currentFontName) && this.currentFontSizeRequired == sizeRequest) {
@ -391,9 +393,9 @@ public class CompositingText extends TextBase {
} }
clear(); clear();
final Uri fontUri = Configs.getConfigFonts().getFontUri(fontName).clone(); final var fontUri = Configs.getConfigFonts().getFontUri(fontName).clone();
fontUri.setProperty("size", Integer.toString(sizeRequest)); fontUri.setProperty("size", Integer.toString(sizeRequest));
LOGGER.trace("plop : " + fontName + " size=" + sizeRequest + " result :" + fontName); LOGGER.trace("plop={} size={} result={}", fontName, sizeRequest, fontName);
// link to new one // link to new one
if (this.forceClimp) { if (this.forceClimp) {
fontUri.setProperty("FORCE_CLIMP", "true"); fontUri.setProperty("FORCE_CLIMP", "true");

View File

@ -1,15 +1,15 @@
package org.atriasoft.ewol.compositing; package org.atriasoft.ewol.compositing;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
public record ShapeBox( public record ShapeBox(
Vector3f outOrigin, Vector2f outOrigin,
Vector3f outSize, Vector2f outSize,
Vector3f inOrigin, Vector2f inOrigin,
Vector3f inSize) { Vector2f inSize) {
public static final ShapeBox ZERO = new ShapeBox(Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO); public static final ShapeBox ZERO = new ShapeBox(Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO);
@Override @Override
public String toString() { public String toString() {
@ -26,18 +26,18 @@ public record ShapeBox(
return out.toString(); return out.toString();
} }
public ShapeBox(final Vector3f outOrigin, final Vector3f outSize, final Vector3f inOrigin, final Vector3f inSize) { public ShapeBox(final Vector2f outOrigin, final Vector2f outSize, final Vector2f inOrigin, final Vector2f inSize) {
this.outOrigin = outOrigin; this.outOrigin = outOrigin;
this.outSize = outSize; this.outSize = outSize;
this.inOrigin = inOrigin; this.inOrigin = inOrigin;
this.inSize = inSize; this.inSize = inSize;
} }
public ShapeBox(final Vector3f outOrigin, final Vector3f outSize, final Padding padding) { public ShapeBox(final Vector2f outOrigin, final Vector2f outSize, final Padding padding) {
this(outOrigin, outSize, outOrigin.add(padding.left(), padding.bottom(), padding.back()), outSize.less(padding.x(), padding.y(), padding.z())); this(outOrigin, outSize, outOrigin.add(padding.left(), padding.bottom()), outSize.less(padding.x(), padding.y()));
} }
public boolean isInside(final Vector3f value) { public boolean isInside(final Vector2f value) {
return value.x() > this.outOrigin.x() // return value.x() > this.outOrigin.x() //
&& value.y() > this.outOrigin.y() // && value.y() > this.outOrigin.y() //
&& value.x() < this.outOrigin.x() + this.outSize.x() // && value.x() < this.outOrigin.x() + this.outSize.x() //

View File

@ -13,7 +13,7 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.util.Dynamic; import org.atriasoft.etk.util.Dynamic;
import org.atriasoft.ewol.compositing.tools.TextDecoration; import org.atriasoft.ewol.compositing.tools.TextDecoration;
import org.atriasoft.ewol.resource.font.FontMode; import org.atriasoft.ewol.resource.font.FontMode;
@ -35,8 +35,8 @@ public abstract class TextBase extends Compositing {
// previously this line and the center is perform with this one) // previously this line and the center is perform with this one)
protected AlignMode alignment = AlignMode.DISABLE; // !< Current Alignment mode (justify/left/right ...) protected AlignMode alignment = AlignMode.DISABLE; // !< Current Alignment mode (justify/left/right ...)
protected boolean clippingEnable = false; // !< true if the clipping must be activated protected boolean clippingEnable = false; // !< true if the clipping must be activated
protected Vector3f clippingPosStart = Vector3f.ZERO; // !< Clipping start position protected Vector2f clippingPosStart = Vector2f.ZERO; // !< Clipping start position
protected Vector3f clippingPosStop = Vector3f.ZERO; // !< Clipping stop position protected Vector2f clippingPosStop = Vector2f.ZERO; // !< Clipping stop position
protected Color color = Color.BLACK; // !< The text foreground color protected Color color = Color.BLACK; // !< The text foreground color
protected Color colorBg = Color.NONE; // !< The text background color protected Color colorBg = Color.NONE; // !< The text background color
protected Color colorCursor = Color.BLACK; // !< The text cursor color protected Color colorCursor = Color.BLACK; // !< The text cursor color
@ -61,11 +61,11 @@ public abstract class TextBase extends Compositing {
protected int oGLtexID = -1; // !< openGL id on the element (texture ID) protected int oGLtexID = -1; // !< openGL id on the element (texture ID)
protected int oGLtextHeight = -1; // !< openGL Id on the texture height protected int oGLtextHeight = -1; // !< openGL Id on the texture height
protected int oGLtextWidth = -1; // !< openGL Id on the texture width protected int oGLtextWidth = -1; // !< openGL Id on the texture width
protected Vector3f position = Vector3f.ZERO; // !< The current position to draw protected Vector2f position = Vector2f.ZERO; // !< The current position to draw
protected Character previousCharcode = '\0'; // !< we remember the previous charcode to perform the kerning. @ref Kerning protected Character previousCharcode = '\0'; // !< we remember the previous charcode to perform the kerning. @ref Kerning
protected int selectionStartPos = -100; // !< start position of the Selection (if == this.cursorPos ==> no protected int selectionStartPos = -100; // !< start position of the Selection (if == this.cursorPos ==> no
protected Vector3f sizeDisplayStart = Vector3f.ZERO; // !< The start windows of the display. protected Vector2f sizeDisplayStart = Vector2f.ZERO; // !< The start windows of the display.
protected Vector3f sizeDisplayStop = Vector3f.ZERO; // !< The end windows of the display. protected Vector2f sizeDisplayStop = Vector2f.ZERO; // !< The end windows of the display.
protected float startTextPos = 0; // !< start position of the Alignment (when \n the text return at this protected float startTextPos = 0; // !< start position of the Alignment (when \n the text return at this
// position) // position)
protected float stopTextPos = 0; // !< end of the alignment (when a string is too height it cut at the word protected float stopTextPos = 0; // !< end of the alignment (when a string is too height it cut at the word
@ -98,7 +98,7 @@ public abstract class TextBase extends Compositing {
* @param charcode The Unicode value to calculate dimention. * @param charcode The Unicode value to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
public Vector3f calculateSize(final Character charcode) { public Vector2f calculateSize(final Character charcode) {
return calculateSizeChar(charcode); return calculateSizeChar(charcode);
} }
@ -107,10 +107,10 @@ public abstract class TextBase extends Compositing {
* @param text The string to calculate dimention. * @param text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
public Vector3f calculateSize(final String text) { public Vector2f calculateSize(final String text) {
Vector3f outputSize = Vector3f.ZERO; Vector2f outputSize = Vector2f.ZERO;
for (int iii = 0; iii < text.length(); iii++) { for (int iii = 0; iii < text.length(); iii++) {
final Vector3f tmpp = calculateSize(text.charAt(iii)); final Vector2f tmpp = calculateSize(text.charAt(iii));
if (outputSize.y() == 0) { if (outputSize.y() == 0) {
outputSize = outputSize.withY(tmpp.y()); outputSize = outputSize.withY(tmpp.y());
} }
@ -120,16 +120,16 @@ public abstract class TextBase extends Compositing {
} }
// ! @previous // ! @previous
public abstract Vector3f calculateSizeChar(Character charcode); public abstract Vector2f calculateSizeChar(Character charcode);
/** /**
* calculate a theoric text size * calculate a theoric text size
* @param text The string to calculate dimention. * @param text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
public Vector3f calculateSizeDecorated(final String text) { public Vector2f calculateSizeDecorated(final String text) {
if (text.length() == 0) { if (text.length() == 0) {
return Vector3f.ZERO; return Vector2f.ZERO;
} }
final StringBuilder tmpData = new StringBuilder("<html><body>\n"); final StringBuilder tmpData = new StringBuilder("<html><body>\n");
@ -143,14 +143,14 @@ public abstract class TextBase extends Compositing {
* @param text The string to calculate dimention. * @param text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
public Vector3f calculateSizeHTML(final String text) { public Vector2f calculateSizeHTML(final String text) {
// remove intermediate result // remove intermediate result
reset(); reset();
// LOGGER.debug(" 0 size for=\n" + text); // LOGGER.debug(" 0 size for=\n" + text);
// disable display system // disable display system
this.needDisplay = false; this.needDisplay = false;
setPos(Vector3f.ZERO); setPos(Vector2f.ZERO);
// same as print without the end display ... // same as print without the end display ...
printHTML(text); printHTML(text);
//LOGGER.error(" ]]]] position={}", this.position); //LOGGER.error(" ]]]] position={}", this.position);
@ -158,17 +158,16 @@ public abstract class TextBase extends Compositing {
//LOGGER.error(" ]]]] sizeDisplayStop={}", this.sizeDisplayStop); //LOGGER.error(" ]]]] sizeDisplayStop={}", this.sizeDisplayStop);
// get the last elements // get the last elements
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop); this.sizeDisplayStop = Vector2f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart); this.sizeDisplayStart = Vector2f.min(this.position, this.sizeDisplayStart);
// LOGGER.debug(" 2 Start pos=" + this.sizeDisplayStart); // LOGGER.debug(" 2 Start pos=" + this.sizeDisplayStart);
// LOGGER.debug(" 2 Stop pos=" + this.sizeDisplayStop); // LOGGER.debug(" 2 Stop pos=" + this.sizeDisplayStop);
// set back the display system // set back the display system
this.needDisplay = true; this.needDisplay = true;
return new Vector3f(this.sizeDisplayStop.x() - this.sizeDisplayStart.x(), return new Vector2f(this.sizeDisplayStop.x() - this.sizeDisplayStart.x(),
this.sizeDisplayStop.y() - this.sizeDisplayStart.y(), this.sizeDisplayStop.y() - this.sizeDisplayStart.y());
this.sizeDisplayStop.z() - this.sizeDisplayStart.z());
} }
/** /**
@ -258,7 +257,7 @@ public abstract class TextBase extends Compositing {
} }
for (int iii = start; iii < text.length(); iii++) { for (int iii = start; iii < text.length(); iii++) {
final Vector3f tmpSize = calculateSize(text.charAt(iii)); final Vector2f tmpSize = calculateSize(text.charAt(iii));
// check overflow : // check overflow :
if (endPos + tmpSize.x() > stopPosition) { if (endPos + tmpSize.x() > stopPosition) {
stop.value = iii; stop.value = iii;
@ -307,7 +306,7 @@ public abstract class TextBase extends Compositing {
*/ */
public void forceLineReturn() { public void forceLineReturn() {
// reset position : // reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), 0)); setPos(new Vector2f(this.startTextPos, this.position.y() - getHeight()));
} }
/** /**
@ -339,7 +338,7 @@ public abstract class TextBase extends Compositing {
* get the current display position (sometime needed in the gui control) * get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
public Vector3f getPos() { public Vector2f getPos() {
return this.position; return this.position;
} }
@ -564,11 +563,11 @@ public abstract class TextBase extends Compositing {
} }
} }
if (this.needDisplay && this.colorBg.a() != 0) { if (this.needDisplay && this.colorBg.a() != 0) {
final Vector3f pos = this.position; final Vector2f pos = this.position;
this.vectorialDraw.setPos(pos); this.vectorialDraw.setPos(pos);
printChar(text.charAt(iii)); printChar(text.charAt(iii));
final float fontHeigh = getHeight(); final float fontHeigh = getHeight();
this.vectorialDraw.rectangleWidth(new Vector3f(this.position.x() - pos.x(), fontHeigh, 0.0f)); this.vectorialDraw.rectangleWidth(new Vector2f(this.position.x() - pos.x(), fontHeigh));
this.nbCharDisplayed++; this.nbCharDisplayed++;
} else { } else {
printChar(text.charAt(iii)); printChar(text.charAt(iii));
@ -613,15 +612,13 @@ public abstract class TextBase extends Compositing {
case RIGHT: case RIGHT:
if (this.needDisplay) { if (this.needDisplay) {
// Move the first char at the right : // Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value, this.position.y(), setPos(new Vector2f(this.position.x() + freeSpace.value, this.position.y()));
this.position.z()));
} }
break; break;
case CENTER: case CENTER:
if (this.needDisplay) { if (this.needDisplay) {
// Move the first char at the right : // Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value / 2, this.position.y(), setPos(new Vector2f(this.position.x() + freeSpace.value / 2, this.position.y()));
this.position.z()));
} }
break; break;
default: default:
@ -658,16 +655,16 @@ public abstract class TextBase extends Compositing {
this.vectorialDraw.setPos(this.position); this.vectorialDraw.setPos(this.position);
} }
// Must generate a dynamic space : // Must generate a dynamic space :
setPos(new Vector3f(this.position.x() + interpolation, this.position.y(), this.position.z())); setPos(new Vector2f(this.position.x() + interpolation, this.position.y()));
if (this.needDisplay && this.colorBg.a() != 0) { if (this.needDisplay && this.colorBg.a() != 0) {
this.vectorialDraw.rectangleWidth(new Vector3f(interpolation, fontHeigh, 0.0f)); this.vectorialDraw.rectangleWidth(new Vector2f(interpolation, fontHeigh));
} }
} else // LOGGER.debug(" generateString : \"" + (char)text[iii] + "\""); } else // LOGGER.debug(" generateString : \"" + (char)text[iii] + "\"");
if (this.needDisplay && this.colorBg.a() != 0) { if (this.needDisplay && this.colorBg.a() != 0) {
final Vector3f pos = this.position; final Vector2f pos = this.position;
this.vectorialDraw.setPos(pos); this.vectorialDraw.setPos(pos);
printChar(text.charAt(iii)); printChar(text.charAt(iii));
this.vectorialDraw.rectangleWidth(new Vector3f(this.position.x() - pos.x(), fontHeigh, 0.0f)); this.vectorialDraw.rectangleWidth(new Vector2f(this.position.x() - pos.x(), fontHeigh));
this.nbCharDisplayed++; this.nbCharDisplayed++;
} else { } else {
printChar(text.charAt(iii)); printChar(text.charAt(iii));
@ -690,12 +687,12 @@ public abstract class TextBase extends Compositing {
} else if (text.charAt(stop.value) == (char) Character.SPACE_SEPARATOR) { } else if (text.charAt(stop.value) == (char) Character.SPACE_SEPARATOR) {
currentId = stop.value + 1; currentId = stop.value + 1;
// reset position : // reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z())); setPos(new Vector2f(this.startTextPos, this.position.y() - getHeight()));
this.nbCharDisplayed++; this.nbCharDisplayed++;
} else if (text.charAt(stop.value) == (char) Character.LINE_SEPARATOR) { } else if (text.charAt(stop.value) == (char) Character.LINE_SEPARATOR) {
currentId = stop.value + 1; currentId = stop.value + 1;
// reset position : // reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z())); setPos(new Vector2f(this.startTextPos, this.position.y() - getHeight()));
this.nbCharDisplayed++; this.nbCharDisplayed++;
} else { } else {
currentId = stop.value; currentId = stop.value;
@ -724,10 +721,10 @@ public abstract class TextBase extends Compositing {
public void printCursor(final boolean isInsertMode, final float cursorSize) { public void printCursor(final boolean isInsertMode, final float cursorSize) {
final int fontHeigh = (int) getHeight(); final int fontHeigh = (int) getHeight();
if (isInsertMode) { if (isInsertMode) {
this.vectorialDraw.rectangleWidth(new Vector3f(cursorSize, fontHeigh, 0)); this.vectorialDraw.rectangleWidth(new Vector2f(cursorSize, fontHeigh));
} else { } else {
this.vectorialDraw.setThickness(2); this.vectorialDraw.setThickness(2);
this.vectorialDraw.lineRel(new Vector3f(0, fontHeigh, 0)); this.vectorialDraw.lineRel(new Vector2f(0, fontHeigh));
this.vectorialDraw.setThickness(0); this.vectorialDraw.setThickness(0);
} }
} }
@ -834,9 +831,9 @@ public abstract class TextBase extends Compositing {
* clear all the intermediate result detween 2 prints * clear all the intermediate result detween 2 prints
*/ */
public void reset() { public void reset() {
this.position = Vector3f.ZERO; this.position = Vector2f.ZERO;
this.clippingPosStart = Vector3f.ZERO; this.clippingPosStart = Vector2f.ZERO;
this.clippingPosStop = Vector3f.ZERO; this.clippingPosStop = Vector2f.ZERO;
this.sizeDisplayStart = this.position; this.sizeDisplayStart = this.position;
this.sizeDisplayStop = this.position; this.sizeDisplayStop = this.position;
this.nbCharDisplayed = 0; this.nbCharDisplayed = 0;
@ -857,32 +854,27 @@ public abstract class TextBase extends Compositing {
} }
@Override @Override
public void rotate(final Vector3f vect, final float angle) { public void rotate(final Vector2f vect, final float angle) {
super.rotate(vect, angle); super.rotate(vect, angle);
this.vectorialDraw.rotate(vect, angle); this.vectorialDraw.rotate(vect, angle);
} }
@Override @Override
public void scale(final Vector3f vect) { public void scale(final Vector2f vect) {
super.scale(vect); super.scale(vect);
this.vectorialDraw.scale(vect); this.vectorialDraw.scale(vect);
} }
// ! @previous
public void setClipping(final Vector2f pos, final Vector2f posEnd) {
setClipping(new Vector3f(pos.x(), pos.y(), -1), new Vector3f(posEnd.x(), posEnd.y(), 1));
}
/** /**
* Request a clipping area for the text (next draw only) * Request a clipping area for the text (next draw only)
* @param pos Start position of the clipping * @param pos Start position of the clipping
* @param posEnd End position of the clipping * @param posEnd End position of the clipping
*/ */
public void setClipping(final Vector3f pos, final Vector3f posEnd) { public void setClipping(final Vector2f pos, final Vector2f posEnd) {
// note the internal system all time request to have a bounding all time in the // note the internal system all time request to have a bounding all time in the
// same order // same order
this.clippingPosStop = Vector3f.max(pos, posEnd); this.clippingPosStop = Vector2f.max(pos, posEnd);
this.clippingPosStart = Vector3f.min(pos, posEnd); this.clippingPosStart = Vector2f.min(pos, posEnd);
this.clippingEnable = true; this.clippingEnable = true;
this.vectorialDraw.setClipping(this.clippingPosStart, this.clippingPosStop); this.vectorialDraw.setClipping(this.clippingPosStart, this.clippingPosStop);
} }
@ -898,17 +890,13 @@ public abstract class TextBase extends Compositing {
this.vectorialDraw.setClippingMode(this.clippingEnable); this.vectorialDraw.setClippingMode(this.clippingEnable);
} }
// ! @previous
public void setClippingWidth(final Vector2f pos, final Vector2f width) {
setClipping(pos, pos.add(width));
}
/** /**
* Request a clipping area for the text (next draw only) * Request a clipping area for the text (next draw only)
* @param pos Start position of the clipping * @param pos Start position of the clipping
* @param width Width size of the clipping * @param width Width size of the clipping
*/ */
public void setClippingWidth(final Vector3f pos, final Vector3f width) { public void setClippingWidth(final Vector2f pos, final Vector2f width) {
setClipping(pos, pos.add(width)); setClipping(pos, pos.add(width));
} }
@ -1051,21 +1039,16 @@ public abstract class TextBase extends Compositing {
this.kerning = newMode; this.kerning = newMode;
} }
// ! @previous
public void setPos(final Vector2f pos) {
setPos(new Vector3f(pos.x(), pos.y(), 0));
}
/** /**
* set position for the next text writen * set position for the next text writen
* @param pos Position of the text (in 3D) * @param pos Position of the text (in 3D)
*/ */
public void setPos(final Vector3f pos) { public void setPos(final Vector2f pos) {
// check min max for display area // check min max for display area
if (this.nbCharDisplayed != 0) { if (this.nbCharDisplayed != 0) {
//LOGGER.trace("update size 1 " + this.sizeDisplayStart + " " + this.sizeDisplayStop); //LOGGER.trace("update size 1 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop); this.sizeDisplayStop = Vector2f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart); this.sizeDisplayStart = Vector2f.min(this.position, this.sizeDisplayStart);
} }
// update position // update position
this.position = pos; this.position = pos;
@ -1078,22 +1061,17 @@ public abstract class TextBase extends Compositing {
//LOGGER.trace("update size 0 " + this.sizeDisplayStart + " " + this.sizeDisplayStop); //LOGGER.trace("update size 0 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
} else { } else {
//LOGGER.trace("update size 3 " + this.sizeDisplayStart + " " + this.sizeDisplayStop); //LOGGER.trace("update size 3 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop); this.sizeDisplayStop = Vector2f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart); this.sizeDisplayStart = Vector2f.min(this.position, this.sizeDisplayStart);
//LOGGER.trace("update size 4 " + this.sizeDisplayStart + " " + this.sizeDisplayStop); //LOGGER.trace("update size 4 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
} }
} }
// ! @previous
public void setRelPos(final Vector2f pos) {
setRelPos(new Vector3f(pos.x(), pos.y(), 0));
}
/** /**
* set relative position for the next text written * set relative position for the next text written
* @param pos offset apply of the text (in 3D) * @param pos offset apply of the text (in 3D)
*/ */
public void setRelPos(final Vector3f pos) { public void setRelPos(final Vector2f pos) {
this.position = this.position.add(pos); this.position = this.position.add(pos);
this.previousCharcode = 0; this.previousCharcode = 0;
this.vectorialDraw.setPos(this.position); this.vectorialDraw.setPos(this.position);
@ -1129,7 +1107,7 @@ public abstract class TextBase extends Compositing {
} }
@Override @Override
public void translate(final Vector3f vect) { public void translate(final Vector2f vect) {
super.translate(vect); super.translate(vect);
this.vectorialDraw.translate(vect); this.vectorialDraw.translate(vect);
} }

View File

@ -10,7 +10,7 @@ import java.time.Clock;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etranslate.ETranslate; import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.event.EntrySystem; import org.atriasoft.ewol.event.EntrySystem;
import org.atriasoft.ewol.object.ObjectManager; import org.atriasoft.ewol.object.ObjectManager;
@ -75,7 +75,7 @@ public class EwolContext extends GaleApplication {
return; return;
} }
final Vector2f size = getSize(); final Vector2f size = getSize();
this.windowsCurrent.setSize(new Vector3f((int) size.x(), (int) size.y(), 0)); this.windowsCurrent.setSize(size.clipInteger());
this.windowsCurrent.onChangeSize(); this.windowsCurrent.onChangeSize();
/// Gale.getContext().aaaaaaaaaaaaaa(); /// Gale.getContext().aaaaaaaaaaaaaa();
} }

View File

@ -9,7 +9,7 @@ import java.lang.ref.WeakReference;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.event.InputSystem; import org.atriasoft.ewol.event.InputSystem;
import org.atriasoft.ewol.widget.Widget; import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.Windows; import org.atriasoft.ewol.widget.Windows;
@ -184,7 +184,7 @@ class InputManager {
// grab all events ... // grab all events ...
tmpWidget = this.grabWidget.get(); tmpWidget = this.grabWidget.get();
} else if (tmpWindows != null) { } else if (tmpWindows != null) {
tmpWidget = tmpWindows.getWidgetAtPos(new Vector3f(pos.x(), pos.y(), 0)); tmpWidget = tmpWindows.getWidgetAtPos(pos);
} }
if (eventTable[pointerID].curentWidgetEvent != null if (eventTable[pointerID].curentWidgetEvent != null
&& tmpWidget != eventTable[pointerID].curentWidgetEvent.get() && tmpWidget != eventTable[pointerID].curentWidgetEvent.get()
@ -329,7 +329,7 @@ class InputManager {
if (tmpWidget != null && type == KeyType.mouse) { if (tmpWidget != null && type == KeyType.mouse) {
eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget); eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
} else { } else {
tmpWidget = tmpWindows.getWidgetAtPos(new Vector3f(pos.x(), pos.y(), 0)); tmpWidget = tmpWindows.getWidgetAtPos(pos);
eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget); eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
/* /*
if (tmpWidget != null) { if (tmpWidget != null) {
@ -461,7 +461,7 @@ class InputManager {
*/ */
public void unGrabPointer() { public void unGrabPointer() {
this.grabWidget = null; this.grabWidget = null;
// TODO this.context.grabPointerEvents(false, Vector3f(0,0)); // TODO this.context.grabPointerEvents(false, Vector2f(0,0));
} }
} }
@ -478,17 +478,17 @@ class InputPoperty {
public boolean isUsed = false; public boolean isUsed = false;
public long lastTimeEvent = 0; // in ns public long lastTimeEvent = 0; // in ns
public int nbClickEvent = 0; // 0 .. 1 .. 2 .. 3 public int nbClickEvent = 0; // 0 .. 1 .. 2 .. 3
public Vector3f origin = Vector3f.ZERO; public Vector2f origin = Vector2f.ZERO;
public Vector2f posEvent = Vector2f.ZERO; public Vector2f posEvent = Vector2f.ZERO;
public Vector3f size = Vector3f.MAX_VALUE; public Vector2f size = Vector2f.MAX_VALUE;
public void clear() { public void clear() {
this.isUsed = false; this.isUsed = false;
this.destinationInputId = 0; this.destinationInputId = 0;
this.lastTimeEvent = System.nanoTime(); this.lastTimeEvent = System.nanoTime();
this.curentWidgetEvent = null; this.curentWidgetEvent = null;
this.origin = Vector3f.ZERO; this.origin = Vector2f.ZERO;
this.size = Vector3f.MAX_VALUE; this.size = Vector2f.MAX_VALUE;
this.downStart = Vector2f.ZERO; this.downStart = Vector2f.ZERO;
this.isDown = false; this.isDown = false;
this.isInside = false; this.isInside = false;

View File

@ -19,7 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* simple display of Colored3DObject ==> for DEBUG only Not availlable on * simple display of Colored3DObject ==> for DEBUG only Not available on
* ALL platform (like webGL) * ALL platform (like webGL)
*/ */
public class RefactorColored3DObject extends Resource { public class RefactorColored3DObject extends Resource {

View File

@ -9,7 +9,7 @@ import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingSVG; import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.event.EventTime;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -40,7 +40,7 @@ public class Box extends Container {
Vector2i startPosition = Vector2i.ZERO; Vector2i startPosition = Vector2i.ZERO;
Vector2i endPosition = Vector2i.ZERO; Vector2i endPosition = Vector2i.ZERO;
public boolean isInside(final Vector3f value) { public boolean isInside(final Vector2f value) {
return value.x() > this.startPosition.x() // return value.x() > this.startPosition.x() //
&& value.y() > this.startPosition.y() // && value.y() > this.startPosition.y() //
&& value.x() < this.endPosition.x() // && value.x() < this.endPosition.x() //
@ -185,8 +185,8 @@ public class Box extends Container {
final Vector2f margin = this.propertyMargin.size().multiply(2); final Vector2f margin = this.propertyMargin.size().multiply(2);
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize); final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize);
this.minSize = new Vector3f(calculatedBoxMinSize.x(), calculatedBoxMinSize.y(), 0); this.minSize = calculatedBoxMinSize;
this.maxSize = Vector3f.max(this.minSize, this.propertyMaxSize.size()); this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size());
markToRedraw(); markToRedraw();
} }
@ -204,7 +204,7 @@ public class Box extends Container {
final float localBorderSize = this.propertyBorderWidth.size(); final float localBorderSize = this.propertyBorderWidth.size();
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize); final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize);
Vector3f subWidgetSize = this.subWidget.getCalculateMinSize(); Vector2f subWidgetSize = this.subWidget.getCalculateMinSize();
if (this.subWidget.canExpand().x() && this.propertyFill.x()) { if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
subWidgetSize = subWidgetSize.withX(this.size.x()); subWidgetSize = subWidgetSize.withX(this.size.x());
} else { } else {
@ -215,13 +215,13 @@ public class Box extends Container {
} else { } else {
subWidgetSize = subWidgetSize.withY(this.minSize.y()); subWidgetSize = subWidgetSize.withY(this.minSize.y());
} }
subWidgetSize = subWidgetSize.less(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0); subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2));
subWidgetSize = subWidgetSize.clipInteger(); subWidgetSize = subWidgetSize.clipInteger();
final Vector3f freeSizeWithoutWidget = this.size final Vector2f freeSizeWithoutWidget = this.size
.less(new Vector3f(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0)).less(subWidgetSize); .less(offsetSubWidget.multiply(2)).less(subWidgetSize);
Vector3f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget)); Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
subWidgetOrigin = subWidgetOrigin.add(new Vector3f(offsetSubWidget.x(), offsetSubWidget.y(), 0)); subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget);
subWidgetOrigin = subWidgetOrigin.clipInteger(); subWidgetOrigin = subWidgetOrigin.clipInteger();
this.subWidget.setOrigin(subWidgetOrigin); this.subWidget.setOrigin(subWidgetOrigin);
this.subWidget.setSize(subWidgetSize); this.subWidget.setSize(subWidgetSize);
@ -231,12 +231,12 @@ public class Box extends Container {
protected Vector2i renderOrigin; protected Vector2i renderOrigin;
protected Vector2i renderSize; protected Vector2i renderSize;
private Vector3f calculateOriginRendering(final Vector3f renderSize) { private Vector2f calculateOriginRendering(final Vector2f renderSize) {
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize)); return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
} }
private Vector3f calculateSizeRendering() { private Vector2f calculateSizeRendering() {
Vector3f tmpRenderSize = this.minSize; Vector2f tmpRenderSize = this.minSize;
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpRenderSize = tmpRenderSize.withX(this.size.x()); tmpRenderSize = tmpRenderSize.withX(this.size.x());
} }
@ -254,11 +254,11 @@ public class Box extends Container {
} }
final Vector2f localMargin = this.propertyMargin.size(); final Vector2f localMargin = this.propertyMargin.size();
Vector3f tmpRenderSize = calculateSizeRendering(); Vector2f tmpRenderSize = calculateSizeRendering();
Vector3f tmpRenderOrigin = calculateOriginRendering(tmpRenderSize); Vector2f tmpRenderOrigin = calculateOriginRendering(tmpRenderSize);
tmpRenderOrigin = tmpRenderOrigin.add(localMargin.x(), localMargin.y(), 0); tmpRenderOrigin = tmpRenderOrigin.add(localMargin);
tmpRenderSize = tmpRenderSize.less(localMargin.x() * 2, localMargin.y() * 2, 0); tmpRenderSize = tmpRenderSize.less(localMargin.multiply(2));
// not sure this is needed... // not sure this is needed...
tmpRenderSize = tmpRenderSize.clipInteger(); tmpRenderSize = tmpRenderSize.clipInteger();
tmpRenderOrigin = tmpRenderOrigin.clipInteger(); tmpRenderOrigin = tmpRenderOrigin.clipInteger();

View File

@ -1,334 +0,0 @@
package org.atriasoft.ewol.widget;
import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Box2 extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Box2.class);
protected CompositingSVG compositing = new CompositingSVG();
public static class BoxParameter {
public Float margin;
public Float padding;
public Float borderWidth;
public Float borderRadius;
public String borderColor;
public String color;
}
/**
* Periodic call to update graphic display
* @param event Time generic event
*/
protected static void periodicCall(final Box2 self, final EventTime event) {
LOGGER.trace("Periodic call on Entry(" + event + ")");
self.markToRedraw();
}
Vector2i startPosition = Vector2i.ZERO;
Vector2i endPosition = Vector2i.ZERO;
public boolean isInside(final Vector3f value) {
return value.x() > this.startPosition.x() //
&& value.y() > this.startPosition.y() //
&& value.x() < this.endPosition.x() //
&& value.y() < this.endPosition.y();
}
/**
* Constructor
*/
public Box2() {}
/**
* Constructor with his subWidget
*/
public Box2(final Widget subWidget) {
super(subWidget);
}
protected Dimension1f propertyBorderWidth = Dimension1f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-width")
@AknotDescription(value = "Border of the box")
public Dimension1f getPropertyBorderWidth() {
return this.propertyBorderWidth;
}
public void setPropertyBorderWidth(final Dimension1f propertyBorder) {
if (this.propertyBorderWidth.equals(propertyBorder)) {
return;
}
this.propertyBorderWidth = propertyBorder;
markToRedraw();
requestUpdateSize();
}
protected Dimension1f propertyBorderRadius = new Dimension1f(0);
@AknotManaged
@AknotAttribute
@AknotName(value = "border-radius")
@AknotDescription(value = "Border radius of the box")
public Dimension1f getPropertyBorderRadius() {
return this.propertyBorderRadius;
}
public void setPropertyBorderRadius(final Dimension1f propertyBorderRadius) {
if (this.propertyBorderRadius.equals(propertyBorderRadius)) {
return;
}
this.propertyBorderRadius = propertyBorderRadius;
markToRedraw();
requestUpdateSize();
}
protected Color propertyBorderColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyBorderColor() {
return this.propertyBorderColor;
}
public void setPropertyBorderColor(final Color propertyBorderColor) {
if (this.propertyBorderColor.equals(propertyBorderColor)) {
return;
}
this.propertyBorderColor = propertyBorderColor;
markToRedraw();
requestUpdateSize();
}
protected Color propertyColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyColor() {
return this.propertyColor;
}
public void setPropertyColor(final Color propertyColor) {
if (this.propertyColor.equals(propertyColor)) {
return;
}
this.propertyColor = propertyColor;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyMargin = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "margin")
@AknotDescription(value = "margin of the box")
public Dimension2f getPropertyMargin() {
return this.propertyMargin;
}
public void setPropertyMargin(final Dimension2f propertyMargin) {
if (this.propertyMargin.equals(propertyMargin)) {
return;
}
this.propertyMargin = propertyMargin;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyPadding = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "padding")
@AknotDescription(value = "Padding of the box")
public Dimension2f getPropertyPadding() {
return this.propertyPadding;
}
public void setPropertyPadding(final Dimension2f propertyPadding) {
if (this.propertyPadding.equals(propertyPadding)) {
return;
}
this.propertyPadding = propertyPadding;
markToRedraw();
requestUpdateSize();
}
@Override
public void calculateMinMaxSize() {
super.calculateMinMaxSize();
final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth);
final Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f,
this.propertyBorderWidth.size() * 2.0f);
final Vector2f padding = this.propertyPadding.size().multiply(2);
final Vector2f margin = this.propertyMargin.size().multiply(2);
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize);
this.minSize = new Vector3f(calculatedBoxMinSize.x(), calculatedBoxMinSize.y(), 0);
this.maxSize = Vector3f.max(this.minSize, this.propertyMaxSize.size());
markToRedraw();
}
@Override
public void onChangeSize() {
markToRedraw();
if (this.propertyHide) {
return;
}
if (this.subWidget == null) {
return;
}
final Vector2f localPadding = this.propertyPadding.size();
final Vector2f localMargin = this.propertyMargin.size();
final float localBorderSize = this.propertyBorderWidth.size();
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize);
Vector3f subWidgetSize = this.subWidget.getCalculateMinSize();
if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
subWidgetSize = subWidgetSize.withX(this.size.x());
} else {
subWidgetSize = subWidgetSize.withX(this.minSize.x());
}
if (this.subWidget.canExpand().y() && this.propertyFill.y()) {
subWidgetSize = subWidgetSize.withY(this.size.y());
} else {
subWidgetSize = subWidgetSize.withY(this.minSize.y());
}
subWidgetSize = subWidgetSize.less(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0);
subWidgetSize = subWidgetSize.clipInteger();
final Vector3f freeSizeWithoutWidget = this.size
.less(new Vector3f(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0)).less(subWidgetSize);
Vector3f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
subWidgetOrigin = subWidgetOrigin.add(new Vector3f(offsetSubWidget.x(), offsetSubWidget.y(), 0));
subWidgetOrigin = subWidgetOrigin.clipInteger();
this.subWidget.setOrigin(subWidgetOrigin);
this.subWidget.setSize(subWidgetSize);
this.subWidget.onChangeSize();
}
protected Vector2i renderOrigin;
protected Vector2i renderSize;
private Vector3f calculateOriginRendering(final Vector3f renderSize) {
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
}
private Vector3f calculateSizeRendering() {
Vector3f tmpRenderSize = this.minSize;
if (this.propertyFill.x()) {
tmpRenderSize = tmpRenderSize.withX(this.size.x());
}
if (this.propertyFill.y()) {
tmpRenderSize = tmpRenderSize.withY(this.size.y());
}
return tmpRenderSize;
}
@Override
public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) {
//return;
}
final Vector2f localMargin = this.propertyMargin.size();
Vector3f tmpRenderSize = calculateSizeRendering();
Vector3f tmpRenderOrigin = calculateOriginRendering(tmpRenderSize);
tmpRenderOrigin = tmpRenderOrigin.add(localMargin.x(), localMargin.y(), 0);
tmpRenderSize = tmpRenderSize.less(localMargin.x() * 2, localMargin.y() * 2, 0);
// not sure this is needed...
tmpRenderSize = tmpRenderSize.clipInteger();
tmpRenderOrigin = tmpRenderOrigin.clipInteger();
this.renderOrigin = new Vector2i((int) tmpRenderOrigin.x(), (int) tmpRenderOrigin.y());
this.renderSize = new Vector2i((int) tmpRenderSize.x(), (int) tmpRenderSize.y());
//System.out.println("renderSize: " + this.renderSize);
// remove data of the previous composition :
this.compositing.clear();
final int borderSize = (int) this.propertyBorderWidth.size();
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
if (borderSize > 0.0f) {
this.compositing.setSource("""
<svg width="%d" height="%d">
<rect
x="%d"
y="%d"
width="%d"
height="%d"
rx="%d"
ry="%d"
fill="%s"
stroke="%s"
stroke-width="%d"
/>
</svg>""".formatted( //
this.renderSize.x(), this.renderSize.y(), //
paddingCompensateBorder, paddingCompensateBorder, //
this.renderSize.x() - 2 * paddingCompensateBorder,
this.renderSize.y() - 2 * paddingCompensateBorder, //
(int) this.propertyBorderRadius.size(), //
(int) this.propertyBorderRadius.size(), //
this.propertyColor.toStringSharp(), //
this.propertyBorderColor.toStringSharp(), //
borderSize //
), //
this.renderSize);
} else {
this.compositing.setSource("""
<svg width="%d" height="%d">
<rect
x="%d"
y="%d"
width="%d"
height="%d"
fill="%s"
/>
</svg>""".formatted( //
this.renderSize.x(), this.renderSize.y(), //
paddingCompensateBorder, paddingCompensateBorder, //
this.renderSize.x() - 2 * paddingCompensateBorder,
this.renderSize.y() - 2 * paddingCompensateBorder, //
this.propertyColor.toStringSharp() //
), //
this.renderSize);
}
this.compositing.setPos(this.renderOrigin);
// For events:
this.startPosition = this.renderOrigin;
this.endPosition = this.renderOrigin.add(this.renderSize);
this.compositing.print(this.renderSize);
this.compositing.flush();
}
@Override
protected void onDraw() {
if (this.compositing != null) {
this.compositing.draw(true);
}
super.onDraw();
}
}

View File

@ -12,8 +12,8 @@ import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventEntry;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
@ -40,8 +40,8 @@ public class Button extends Box {
final Button out = new Button(); final Button out = new Button();
final Label labelWidget = new Label(); final Label labelWidget = new Label();
labelWidget.setPropertyFontSize(12); labelWidget.setPropertyFontSize(12);
labelWidget.setPropertyFill(Vector3b.FALSE); labelWidget.setPropertyFill(Vector2b.FALSE);
labelWidget.setPropertyExpand(Vector3b.FALSE); labelWidget.setPropertyExpand(Vector2b.FALSE);
labelWidget.setPropertyGravity(Gravity.CENTER); labelWidget.setPropertyGravity(Gravity.CENTER);
labelWidget.setPropertyValue(label); labelWidget.setPropertyValue(label);
out.setSubWidget(labelWidget); out.setSubWidget(labelWidget);
@ -97,8 +97,8 @@ public class Button extends Box {
//onChangePropertyShaper(); //onChangePropertyShaper();
// can not support multiple click... // can not support multiple click...
setMouseLimit(1); setMouseLimit(1);
setPropertyExpand(Vector3b.TRUE); setPropertyExpand(Vector2b.TRUE);
setPropertyFill(Vector3b.TRUE); setPropertyFill(Vector2b.TRUE);
setPropertyBorderWidth(new Dimension1f(4)); setPropertyBorderWidth(new Dimension1f(4));
//setPropertyBorderRadius(new Dimension1f(15)); //setPropertyBorderRadius(new Dimension1f(15));
setPropertyBorderColor(Color.BLACK); setPropertyBorderColor(Color.BLACK);
@ -128,7 +128,7 @@ public class Button extends Box {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
final Vector3f relPos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); final Vector2f relPos = relativePosition(event.pos());
//LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos); //LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = isInside(relPos); final boolean over = isInside(relPos);
//filter if outside the element... //filter if outside the element...

View File

@ -7,7 +7,7 @@ import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.aknot.annotation.AknotSignal; import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.Signal;
import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.widget.Sizer.DisplayMode; import org.atriasoft.ewol.widget.Sizer.DisplayMode;
@ -60,13 +60,13 @@ public class CheckBox extends Container {
public CheckBox(final String basicLabel) { public CheckBox(final String basicLabel) {
final Sizer subs = new Sizer(DisplayMode.HORIZONTAL); final Sizer subs = new Sizer(DisplayMode.HORIZONTAL);
subs.setPropertyLockExpand(Vector3b.TRUE); subs.setPropertyLockExpand(Vector2b.TRUE);
subs.setPropertyGravity(Gravity.CENTER); subs.setPropertyGravity(Gravity.CENTER);
setSubWidget(subs); setSubWidget(subs);
this.tick = new Tick(); this.tick = new Tick();
this.tick.setPropertyExpand(new Vector3b(false, true, true)); this.tick.setPropertyExpand(Vector2b.FALSE_TRUE);
this.tick.setPropertyFill(Vector3b.FALSE); this.tick.setPropertyFill(Vector2b.FALSE);
this.tick.setPropertyGravity(Gravity.CENTER); this.tick.setPropertyGravity(Gravity.CENTER);
subs.subWidgetAdd(this.tick); subs.subWidgetAdd(this.tick);
this.tick.signalClick.connectAuto(this, CheckBox::eventTickClick); this.tick.signalClick.connectAuto(this, CheckBox::eventTickClick);
@ -75,8 +75,8 @@ public class CheckBox extends Container {
this.tick.signalValue.connectAuto(this, CheckBox::eventTickValue); this.tick.signalValue.connectAuto(this, CheckBox::eventTickValue);
this.label = new Label(basicLabel); this.label = new Label(basicLabel);
this.label.setPropertyExpand(Vector3b.TRUE); this.label.setPropertyExpand(Vector2b.TRUE);
this.label.setPropertyFill(Vector3b.FALSE); this.label.setPropertyFill(Vector2b.FALSE);
this.label.setPropertyGravity(Gravity.LEFT); this.label.setPropertyGravity(Gravity.LEFT);
subs.subWidgetAdd(this.label); subs.subWidgetAdd(this.label);
this.label.signalPressed.connectAuto(this, CheckBox::eventLabelClick); this.label.signalPressed.connectAuto(this, CheckBox::eventLabelClick);

View File

@ -11,10 +11,10 @@ import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.aknot.exception.AknotException; import org.atriasoft.aknot.exception.AknotException;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.object.EwolObject;
@ -111,7 +111,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b canExpand() { public Vector2b canExpand() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canExpand(); return this.subWidget.canExpand();
@ -120,7 +120,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b canExpandIfFree() { public Vector2b canExpandIfFree() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canExpandIfFree(); return this.subWidget.canExpandIfFree();
@ -129,7 +129,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b canFill() { public Vector2b canFill() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canFill(); return this.subWidget.canFill();
@ -166,7 +166,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3f getCalculateMaxSize() { public Vector2f getCalculateMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getCalculateMaxSize(); return this.subWidget.getCalculateMaxSize();
@ -175,7 +175,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3f getCalculateMinSize() { public Vector2f getCalculateMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getCalculateMinSize(); return this.subWidget.getCalculateMinSize();
@ -220,7 +220,7 @@ public class Composer extends Container {
} }
@Override @Override
Vector3f getOffset() { Vector2f getOffset() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getOffset(); return this.subWidget.getOffset();
} }
@ -228,7 +228,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3f getOrigin() { public Vector2f getOrigin() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getOrigin(); return this.subWidget.getOrigin();
} }
@ -245,7 +245,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b getPropertyExpand() { public Vector2b getPropertyExpand() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyExpand(); return this.subWidget.getPropertyExpand();
@ -254,7 +254,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b getPropertyExpandIfFree() { public Vector2b getPropertyExpandIfFree() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyExpandIfFree(); return this.subWidget.getPropertyExpandIfFree();
@ -263,7 +263,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3b getPropertyFill() { public Vector2b getPropertyFill() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyFill(); return this.subWidget.getPropertyFill();
@ -290,7 +290,7 @@ public class Composer extends Container {
} }
@Override @Override
public Dimension3f getPropertyMaxSize() { public Dimension2f getPropertyMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyMaxSize(); return this.subWidget.getPropertyMaxSize();
@ -299,7 +299,7 @@ public class Composer extends Container {
} }
@Override @Override
public Dimension3f getPropertyMinSize() { public Dimension2f getPropertyMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyMinSize(); return this.subWidget.getPropertyMinSize();
@ -316,7 +316,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3f getSize() { public Vector2f getSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getSize(); return this.subWidget.getSize();
@ -482,7 +482,7 @@ public class Composer extends Container {
} }
@Override @Override
public Vector3f relativePosition(final Vector3f pos) { public Vector2f relativePosition(final Vector2f pos) {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.relativePosition(pos); return this.subWidget.relativePosition(pos);
} }
@ -560,7 +560,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setOffset(final Vector3f newVal) { public void setOffset(final Vector2f newVal) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setOffset(newVal); this.subWidget.setOffset(newVal);
return; return;
@ -569,7 +569,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setOrigin(final Vector3f pos) { public void setOrigin(final Vector2f pos) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setOrigin(pos); this.subWidget.setOrigin(pos);
return; return;
@ -587,7 +587,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setPropertyExpand(final Vector3b value) { public void setPropertyExpand(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setPropertyExpand(value); this.subWidget.setPropertyExpand(value);
return; return;
@ -596,7 +596,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setPropertyExpandIfFree(final Vector3b value) { public void setPropertyExpandIfFree(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setPropertyExpandIfFree(value); this.subWidget.setPropertyExpandIfFree(value);
return; return;
@ -605,7 +605,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setPropertyFill(final Vector3b value) { public void setPropertyFill(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setPropertyFill(value); this.subWidget.setPropertyFill(value);
return; return;
@ -632,7 +632,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setPropertyMaxSize(final Dimension3f value) { public void setPropertyMaxSize(final Dimension2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setPropertyMaxSize(value); this.subWidget.setPropertyMaxSize(value);
return; return;
@ -641,7 +641,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setPropertyMinSize(final Dimension3f value) { public void setPropertyMinSize(final Dimension2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setPropertyMinSize(value); this.subWidget.setPropertyMinSize(value);
return; return;
@ -665,7 +665,7 @@ public class Composer extends Container {
} }
@Override @Override
public void setSize(final Vector3f value) { public void setSize(final Vector2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.setSize(value); this.subWidget.setSize(value);
return; return;

View File

@ -9,8 +9,8 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotFactory; import org.atriasoft.aknot.annotation.AknotFactory;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.object.EwolObject;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -43,8 +43,8 @@ public class Container extends Widget {
// call sub classes // call sub classes
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.calculateMinMaxSize(); this.subWidget.calculateMinMaxSize();
final Vector3f min = this.subWidget.getCalculateMinSize(); final Vector2f min = this.subWidget.getCalculateMinSize();
this.minSize = Vector3f.max(this.minSize, min); this.minSize = Vector2f.max(this.minSize, min);
} }
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize); LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
} }
@ -83,7 +83,7 @@ public class Container extends Widget {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (!this.propertyHide) { if (!this.propertyHide) {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getWidgetAtPos(pos); return this.subWidget.getWidgetAtPos(pos);
@ -146,9 +146,9 @@ public class Container extends Widget {
if (this.subWidget == null) { if (this.subWidget == null) {
return; return;
} }
Vector3f origin = this.origin.add(this.offset); Vector2f origin = this.origin.add(this.offset);
final Vector3f minSize = this.subWidget.getCalculateMinSize(); final Vector2f minSize = this.subWidget.getCalculateMinSize();
final Vector3b expand = this.subWidget.getPropertyExpand(); final Vector2b expand = this.subWidget.getPropertyExpand();
origin = origin.add(this.propertyGravity.gravityGenerateDelta(minSize.less(this.size))); origin = origin.add(this.propertyGravity.gravityGenerateDelta(minSize.less(this.size)));
this.subWidget.setOrigin(origin); this.subWidget.setOrigin(origin);
this.subWidget.setSize(this.size); this.subWidget.setSize(this.size);
@ -176,7 +176,7 @@ public class Container extends Widget {
} }
@Override @Override
public void setOffset(final Vector3f newVal) { public void setOffset(final Vector2f newVal) {
if (this.offset.equals(newVal)) { if (this.offset.equals(newVal)) {
return; return;
} }

View File

@ -15,8 +15,8 @@ import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotFactory; import org.atriasoft.aknot.annotation.AknotFactory;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.object.EwolObject;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -29,8 +29,8 @@ import org.slf4j.LoggerFactory;
public class ContainerN extends Widget { public class ContainerN extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerN.class); private static final Logger LOGGER = LoggerFactory.getLogger(ContainerN.class);
protected Vector3b propertyLockExpand = Vector3b.FALSE; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget protected Vector2b propertyLockExpand = Vector2b.FALSE; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
protected Vector3b subExpend = Vector3b.FALSE; //!< reference of the sub element expention requested. protected Vector2b subExpend = Vector2b.FALSE; //!< reference of the sub element expention requested.
protected List<Widget> subWidget = new ArrayList<>(); protected List<Widget> subWidget = new ArrayList<>();
/** /**
@ -40,22 +40,22 @@ public class ContainerN extends Widget {
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
this.subExpend = Vector3b.FALSE; this.subExpend = Vector2b.FALSE;
this.minSize = Vector3f.ZERO; this.minSize = Vector2f.ZERO;
this.maxSize = Vector3f.MAX_VALUE; this.maxSize = Vector2f.MAX_VALUE;
//LOGGER.error("[" + getId() + "] {" + getObjectType() + "} set min size : " + this.minSize); //LOGGER.error("[" + getId() + "] {" + getObjectType() + "} set min size : " + this.minSize);
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it != null) { if (it != null) {
it.calculateMinMaxSize(); it.calculateMinMaxSize();
final Vector3b subExpendProp = it.canExpand(); final Vector2b subExpendProp = it.canExpand();
if (subExpendProp.x()) { if (subExpendProp.x()) {
this.subExpend = this.subExpend.withX(true); this.subExpend = this.subExpend.withX(true);
} }
if (subExpendProp.y()) { if (subExpendProp.y()) {
this.subExpend = this.subExpend.withX(true); this.subExpend = this.subExpend.withX(true);
} }
final Vector3f tmpSize = it.getCalculateMinSize(); final Vector2f tmpSize = it.getCalculateMinSize();
this.minSize = Vector3f.max(tmpSize, this.minSize); this.minSize = Vector2f.max(tmpSize, this.minSize);
} }
} }
LOGGER.warn("[{}] Result min size : {}", getId(), this.minSize); LOGGER.warn("[{}] Result min size : {}", getId(), this.minSize);
@ -63,8 +63,8 @@ public class ContainerN extends Widget {
// herited function // herited function
@Override @Override
public Vector3b canExpand() { public Vector2b canExpand() {
Vector3b res = this.propertyExpand; Vector2b res = this.propertyExpand;
if (!this.propertyLockExpand.x()) { if (!this.propertyLockExpand.x()) {
if (this.subExpend.x()) { if (this.subExpend.x()) {
res = res.withX(true); res = res.withX(true);
@ -94,7 +94,7 @@ public class ContainerN extends Widget {
@AknotAttribute @AknotAttribute
@AknotName(value = "lock") @AknotName(value = "lock")
@AknotDescription(value = "Lock the subwidget expand") @AknotDescription(value = "Lock the subwidget expand")
public Vector3b getPropertyLockExpand() { public Vector2b getPropertyLockExpand() {
return this.propertyLockExpand; return this.propertyLockExpand;
} }
@ -123,15 +123,15 @@ public class ContainerN extends Widget {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (this.propertyHide) { if (this.propertyHide) {
return null; return null;
} }
// for all element in the sizer ... // for all element in the sizer ...
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it != null) { if (it != null) {
final Vector3f tmpSize = it.getSize(); final Vector2f tmpSize = it.getSize();
final Vector3f tmpOrigin = it.getOrigin(); final Vector2f tmpOrigin = it.getOrigin();
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) { && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
final Widget tmpWidget = it.getWidgetAtPos(pos); final Widget tmpWidget = it.getWidgetAtPos(pos);
@ -187,7 +187,7 @@ public class ContainerN extends Widget {
} }
@Override @Override
public void setOffset(final Vector3f newVal) { public void setOffset(final Vector2f newVal) {
if (this.offset != newVal) { if (this.offset != newVal) {
super.setOffset(newVal); super.setOffset(newVal);
// recalculate the new sise and position of sub widget ... // recalculate the new sise and position of sub widget ...
@ -195,7 +195,7 @@ public class ContainerN extends Widget {
} }
} }
public void setPropertyLockExpand(final Vector3b propertyLockExpand) { public void setPropertyLockExpand(final Vector2b propertyLockExpand) {
if (propertyLockExpand.equals(this.propertyLockExpand)) { if (propertyLockExpand.equals(this.propertyLockExpand)) {
return; return;
} }

View File

@ -8,7 +8,7 @@ package org.atriasoft.ewol.widget;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotFactory; import org.atriasoft.aknot.annotation.AknotFactory;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.object.EwolObject;
@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory;
/* /*
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* the Cotainer widget is a widget that have an only one subWidget * the Container widget is a widget that have an only one subWidget
*/ */
public class ContainerToggle extends Widget { public class ContainerToggle extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerToggle.class); private static final Logger LOGGER = LoggerFactory.getLogger(ContainerToggle.class);
@ -34,17 +34,17 @@ public class ContainerToggle extends Widget {
void calculateMinMaxSizePadded(final Padding padding) { void calculateMinMaxSizePadded(final Padding padding) {
// call main class // call main class
this.minSize = Vector3f.ZERO; this.minSize = Vector2f.ZERO;
// call sub classes // call sub classes
for (final Widget element : this.subWidget) { for (final Widget element : this.subWidget) {
if (element != null) { if (element != null) {
element.calculateMinMaxSize(); element.calculateMinMaxSize();
final Vector3f min = element.getCalculateMinSize(); final Vector2f min = element.getCalculateMinSize();
this.minSize = this.minSize.max(min); this.minSize = this.minSize.max(min);
} }
} }
// add padding : // add padding :
this.minSize = this.minSize.add(padding.x(), padding.y(), padding.z()); this.minSize = this.minSize.add(padding.x(), padding.y());
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
//markToRedraw(); //markToRedraw();
@ -90,26 +90,23 @@ public class ContainerToggle extends Widget {
public Padding onChangeSizePadded(final Padding padding) { public Padding onChangeSizePadded(final Padding padding) {
super.onChangeSize(); super.onChangeSize();
final Vector3f localAvaillable = this.size.less(padding.x(), padding.y(), padding.z()); final Vector2f localAvaillable = this.size.less(padding.x(), padding.y());
// Checking the filling properties == > for the subElements: // Checking the filling properties == > for the subElements:
Vector3f subElementSize = this.minSize.less(padding.x(), padding.y(), padding.z()); Vector2f subElementSize = this.minSize.less(padding.x(), padding.y());
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
subElementSize = subElementSize.withX(this.size.x() - padding.x()); subElementSize = subElementSize.withX(this.size.x() - padding.x());
} }
if (this.propertyFill.y()) { if (this.propertyFill.y()) {
subElementSize = subElementSize.withY(this.size.y() - padding.y()); subElementSize = subElementSize.withY(this.size.y() - padding.y());
} }
if (this.propertyFill.z()) { final Vector2f delta = this.propertyGravity
subElementSize = subElementSize.withZ(this.size.z() - padding.z()); .gravityGenerateDelta(this.size.less(subElementSize.add(padding.x(), padding.y())));
} final Vector2f deltaPadded = delta.add(padding.left(), padding.bottom());
final Vector3f delta = this.propertyGravity
.gravityGenerateDelta(this.size.less(subElementSize.add(padding.x(), padding.y(), padding.z())));
final Vector3f deltaPadded = delta.add(padding.left(), padding.bottom(), padding.back());
//subElementSize = subElementSize.less(padding.x(), padding.y(), padding.z()); //subElementSize = subElementSize.less(padding.x(), padding.y(), padding.z());
for (final Widget element : this.subWidget) { for (final Widget element : this.subWidget) {
if (element != null) { if (element != null) {
//final Vector3f origin2 = this.origin.add(this.offset); //final Vector2f origin2 = this.origin.add(this.offset);
//final Vector3f minSize = this.subWidget[iii].getCalculateMinSize(); //final Vector2f minSize = this.subWidget[iii].getCalculateMinSize();
//Vector2b expand = this.subWidget[iii].propertyExpand.get(); //Vector2b expand = this.subWidget[iii].propertyExpand.get();
//origin2 = origin2.add(this.propertyGravity.gravityGenerateDelta(minSize.less(localAvaillable))); //origin2 = origin2.add(this.propertyGravity.gravityGenerateDelta(minSize.less(localAvaillable)));
element.setOrigin(this.origin.add(deltaPadded)); element.setOrigin(this.origin.add(deltaPadded));
@ -117,9 +114,9 @@ public class ContainerToggle extends Widget {
element.onChangeSize(); element.onChangeSize();
} }
} }
final Vector3f selectableAreaPos = this.origin.add(delta);//.less(padding.left(), padding.bottom(), padding.back()); final Vector2f selectableAreaPos = this.origin.add(delta);//.less(padding.left(), padding.bottom(), padding.back());
final Vector3f selectableAreaEndPos = this.size final Vector2f selectableAreaEndPos = this.size
.less(selectableAreaPos.add(subElementSize.add(padding.x(), padding.y(), padding.z()))); .less(selectableAreaPos.add(subElementSize.add(padding.x(), padding.y())));
markToRedraw(); markToRedraw();
return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(), return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(),
selectableAreaPos.y()); selectableAreaPos.y());
@ -153,7 +150,7 @@ public class ContainerToggle extends Widget {
} }
@Override @Override
public void setOffset(final Vector3f newVal) { public void setOffset(final Vector2f newVal) {
if (this.offset.equals(newVal)) { if (this.offset.equals(newVal)) {
return; return;
} }

View File

@ -15,7 +15,7 @@ import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingSVG; import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.compositing.CompositingText;
@ -45,7 +45,7 @@ public class Entry extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Entry.class); private static final Logger LOGGER = LoggerFactory.getLogger(Entry.class);
/** /**
* Periodic call to update grapgic display * Periodic call to update graphic display
* @param _event Time generic event * @param _event Time generic event
*/ */
protected static void periodicCall(final Entry self, final EventTime event) { protected static void periodicCall(final Entry self, final EventTime event) {
@ -103,9 +103,9 @@ public class Entry extends Widget {
@AknotDescription("Entry box value change") @AknotDescription("Entry box value change")
public Signal<String> signalModify = new Signal<>(); //!< data change public Signal<String> signalModify = new Signal<>(); //!< data change
// element over: // element over:
Vector3f overPositionStart = Vector3f.ZERO; Vector2f overPositionStart = Vector2f.ZERO;
Vector3f overPositionStop = Vector3f.ZERO; Vector2f overPositionStop = Vector2f.ZERO;
/** /**
* Constructor * Constructor
@ -137,10 +137,10 @@ public class Entry extends Widget {
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
final int minHeight = (int) this.text.getHeight();//calculateSize('A').y(); final int minHeight = (int) this.text.getHeight();//calculateSize('A').y();
Vector3f minimumSizeBase = new Vector3f(20, minHeight, 10); Vector2f minimumSizeBase = new Vector2f(20, minHeight);
// add padding : // add padding :
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y(), padding.z()); minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
this.minSize = Vector3f.max(this.minSize, minimumSizeBase); this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
//LOGGER.trace("min size = " + this.minSize); //LOGGER.trace("min size = " + this.minSize);
@ -405,8 +405,8 @@ public class Entry extends Widget {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
final Vector3f absolutePosition = new Vector3f(event.pos().x(), event.pos().y(), 0); final Vector2f absolutePosition = event.pos();
final Vector3f relPos = relativePosition(absolutePosition); final Vector2f relPos = relativePosition(absolutePosition);
LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos); LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos);
if (event.inputId() == 0) { if (event.inputId() == 0) {
if (!isFocused()) { if (!isFocused()) {
@ -539,8 +539,8 @@ public class Entry extends Widget {
updateTextPosition(); updateTextPosition();
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
Vector3f tmpSizeShaper = this.minSize; Vector2f tmpSizeShaper = this.minSize;
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
delta = delta.withX(0.0f); delta = delta.withX(0.0f);
@ -549,31 +549,27 @@ public class Entry extends Widget {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y()); tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
} }
if (this.propertyFill.z()) { Vector2f tmpOriginShaper = delta;
tmpSizeShaper = tmpSizeShaper.withZ(this.size.z()); //Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
delta = delta.withZ(0.0f); Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
} Vector2f tmpOriginText = tmpOriginShaper.add(padding.bottom(), padding.left()); //this.size.less(tmpSizeText).multiply(0.5f);
Vector3f tmpOriginShaper = delta; //Vector2f tmpOriginText = new Vector2f(0, this.text.getSize(), 0);
//Vector3f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
Vector3f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y(), padding.z());
Vector3f tmpOriginText = tmpOriginShaper.add(padding.bottom(), padding.left(), padding.back()); //this.size.less(tmpSizeText).multiply(0.5f);
//Vector3f tmpOriginText = new Vector3f(0, this.text.getSize(), 0);
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ... // sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
final int minHeight = (int) this.text.getHeight(); final int minHeight = (int) this.text.getHeight();
if (tmpSizeText.y() > minHeight) { if (tmpSizeText.y() > minHeight) {
tmpOriginText = tmpOriginText.add(0, (tmpSizeText.y() - minHeight) * 0.5f, 0); tmpOriginText = tmpOriginText.add(0, (tmpSizeText.y() - minHeight) * 0.5f);
} }
// fix all the position in the int class: // fix all the position in the int class:
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper); tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper); tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
tmpSizeText = Vector3f.clipInt(tmpSizeText); tmpSizeText = Vector2f.clipInt(tmpSizeText);
tmpOriginText = Vector3f.clipInt(tmpOriginText); tmpOriginText = Vector2f.clipInt(tmpOriginText);
this.text.clear(); this.text.clear();
//this.text.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y()); //this.text.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y());
this.text.setClippingWidth(tmpOriginText, tmpSizeText); this.text.setClippingWidth(tmpOriginText, tmpSizeText);
this.text.setPos(tmpOriginText.add(this.displayStartPosition, 0, 0)); this.text.setPos(tmpOriginText.add(this.displayStartPosition, 0));
if (this.displayCursorPosSelection != this.displayCursorPos) { if (this.displayCursorPosSelection != this.displayCursorPos) {
this.text.setCursorSelection(this.displayCursorPos, this.displayCursorPosSelection); this.text.setCursorSelection(this.displayCursorPos, this.displayCursorPosSelection);
} else { } else {
@ -748,14 +744,14 @@ public class Entry extends Widget {
* @param pos Absolute position of the event * @param pos Absolute position of the event
* @note The display is automaticly requested when change apear. * @note The display is automaticly requested when change apear.
*/ */
protected void updateCursorPosition(final Vector3f pos) { protected void updateCursorPosition(final Vector2f pos) {
updateCursorPosition(pos, false); updateCursorPosition(pos, false);
} }
protected void updateCursorPosition(final Vector3f pos, final boolean selection/*=false*/) { protected void updateCursorPosition(final Vector2f pos, final boolean selection/*=false*/) {
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
final Vector3f relPos = relativePosition(pos).less(this.overPositionStart); final Vector2f relPos = relativePosition(pos).less(this.overPositionStart);
// reject when outside ... // reject when outside ...
// try to find the new cursor position : // try to find the new cursor position :

View File

@ -8,7 +8,7 @@ package org.atriasoft.ewol.widget;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -32,7 +32,7 @@ class Gird extends Widget {
protected Widget tmpWidget = null; //!< use when replace a widget ... protected Widget tmpWidget = null; //!< use when replace a widget ...
protected boolean gavityButtom = true; protected boolean gavityButtom = true;
protected Vector3f propertyBorderSize = Vector3f.ZERO; //!< Border size needed for all the display protected Vector2f propertyBorderSize = Vector2f.ZERO; //!< Border size needed for all the display
/** /**
* Constructor * Constructor
@ -61,7 +61,7 @@ class Gird extends Widget {
} }
if (this.subWidget.get(iii).widget != null) { if (this.subWidget.get(iii).widget != null) {
this.subWidget.get(iii).widget.calculateMinMaxSize(); this.subWidget.get(iii).widget.calculateMinMaxSize();
final Vector3f tmpSize = this.subWidget.get(iii).widget.getCalculateMinSize(); final Vector2f tmpSize = this.subWidget.get(iii).widget.getCalculateMinSize();
LOGGER.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize); LOGGER.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize);
// for all we get the max size : // for all we get the max size :
this.uniformSizeRow = Math.max((int) tmpSize.y(), this.uniformSizeRow); this.uniformSizeRow = Math.max((int) tmpSize.y(), this.uniformSizeRow);
@ -82,7 +82,7 @@ class Gird extends Widget {
} }
LOGGER.debug(" tmpSizeWidth=" + tmpSizeWidth); LOGGER.debug(" tmpSizeWidth=" + tmpSizeWidth);
LOGGER.debug(" this.uniformSizeRow=" + this.uniformSizeRow); LOGGER.debug(" this.uniformSizeRow=" + this.uniformSizeRow);
this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow, 0); this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow);
LOGGER.debug("Calculate min size : " + this.minSize); LOGGER.debug("Calculate min size : " + this.minSize);
@ -93,7 +93,7 @@ class Gird extends Widget {
* get the current border size of the current element: * get the current border size of the current element:
* @return the border size (0 if not used) * @return the border size (0 if not used)
*/ */
public Vector3f getBorderSize() { public Vector2f getBorderSize() {
return this.propertyBorderSize; return this.propertyBorderSize;
} }
@ -113,7 +113,7 @@ class Gird extends Widget {
return 0; return 0;
} }
public Vector3f getPropertyBorderSize() { public Vector2f getPropertyBorderSize() {
return this.propertyBorderSize; return this.propertyBorderSize;
} }
@ -126,7 +126,7 @@ class Gird extends Widget {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (this.propertyHide) { if (this.propertyHide) {
return null; return null;
} }
@ -135,8 +135,8 @@ class Gird extends Widget {
if (it.widget == null) { if (it.widget == null) {
continue; continue;
} }
final Vector3f tmpSize = it.widget.getSize(); final Vector2f tmpSize = it.widget.getSize();
final Vector3f tmpOrigin = it.widget.getOrigin(); final Vector2f tmpOrigin = it.widget.getOrigin();
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) { && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
final Widget tmpWidget = it.widget.getWidgetAtPos(pos); final Widget tmpWidget = it.widget.getWidgetAtPos(pos);
@ -153,15 +153,14 @@ class Gird extends Widget {
@Override @Override
public void onChangeSize() { public void onChangeSize() {
//LOGGER.debug("Update size"); //LOGGER.debug("Update size");
this.size = this.size.less(this.propertyBorderSize.x() * 2, this.propertyBorderSize.y() * 2, this.size = this.size.less(this.propertyBorderSize.multiply(2));
this.propertyBorderSize.y() * 2);
for (int iii = 0; iii < this.subWidget.size(); iii++) { for (int iii = 0; iii < this.subWidget.size(); iii++) {
if (this.subWidget.get(iii).widget != null) { if (this.subWidget.get(iii).widget != null) {
//calculate the origin : //calculate the origin :
Vector3f tmpOrigin = this.origin.add(this.propertyBorderSize); Vector2f tmpOrigin = this.origin.add(this.propertyBorderSize);
if (!this.gavityButtom) { if (!this.gavityButtom) {
tmpOrigin = tmpOrigin.add(0, this.size.y() - this.propertyBorderSize.y(), 0); tmpOrigin = tmpOrigin.add(0, this.size.y() - this.propertyBorderSize.y());
} }
int tmpSizeWidth = 0; int tmpSizeWidth = 0;
@ -175,15 +174,15 @@ class Gird extends Widget {
} else { } else {
addingPos = -(this.subWidget.get(iii).row + 1) * this.uniformSizeRow; addingPos = -(this.subWidget.get(iii).row + 1) * this.uniformSizeRow;
} }
tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos, 0); tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos);
LOGGER.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin, LOGGER.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin,
new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0)); new Vector2f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow));
// set the origin : // set the origin :
this.subWidget.get(iii).widget.setOrigin(tmpOrigin.clipInteger()); this.subWidget.get(iii).widget.setOrigin(tmpOrigin.clipInteger());
// all time set all the space . // all time set all the space .
this.subWidget.get(iii).widget.setSize( this.subWidget.get(iii).widget.setSize(
(new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0)) (new Vector2f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow))
.clipInteger()); .clipInteger());
this.subWidget.get(iii).widget.onChangeSize(); this.subWidget.get(iii).widget.onChangeSize();
} }
@ -206,7 +205,7 @@ class Gird extends Widget {
* set the current border size of the current element: * set the current border size of the current element:
* @param newBorderSize The border size to set (0 if not used) * @param newBorderSize The border size to set (0 if not used)
*/ */
public void setBorderSize(final Vector3f newBorderSize) { public void setBorderSize(final Vector2f newBorderSize) {
this.propertyBorderSize = newBorderSize; this.propertyBorderSize = newBorderSize;
} }
@ -276,7 +275,7 @@ class Gird extends Widget {
markToRedraw(); markToRedraw();
} }
public void setPropertyBorderSize(final Vector3f propertyBorderSize) { public void setPropertyBorderSize(final Vector2f propertyBorderSize) {
this.propertyBorderSize = propertyBorderSize; this.propertyBorderSize = propertyBorderSize;
if (this.propertyBorderSize.x() < 0) { if (this.propertyBorderSize.x() < 0) {
LOGGER.error("Try to set a border size <0 on x : " + this.propertyBorderSize.x() + " == > restore to 0"); LOGGER.error("Try to set a border size <0 on x : " + this.propertyBorderSize.x() + " == > restore to 0");

View File

@ -16,7 +16,7 @@ import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingImage; import org.atriasoft.ewol.compositing.CompositingImage;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.resource.ResourceColorFile; import org.atriasoft.ewol.resource.ResourceColorFile;
@ -56,26 +56,26 @@ public class ImageDisplay extends Widget {
+ " min-size=" + this.propertyMinSize); + " min-size=" + this.propertyMinSize);
final Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f); final Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f);
final Vector2f imageSize = this.propertyImageSize.getPixel(); final Vector2f imageSize = this.propertyImageSize.getPixel();
final Vector3f size = this.propertyMinSize.getPixel(); final Vector2f size = this.propertyMinSize.getPixel();
LOGGER.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size); LOGGER.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size);
if (!imageSize.isZero()) { if (!imageSize.isZero()) {
final Vector2f tmp = imageBoder.add(imageSize); final Vector2f tmp = imageBoder.add(imageSize);
this.minSize = new Vector3f(tmp.x(), tmp.y(), 0); this.minSize = new Vector2f(tmp.x(), tmp.y());
this.maxSize = this.minSize; this.maxSize = this.minSize;
} else { } else {
final Vector2i imageSizeReal = getPropertyMinSize().getPixeli();//.compositing.getRealSize(); final Vector2i imageSizeReal = getPropertyMinSize().getPixeli();//.compositing.getRealSize();
LOGGER.trace(" Real Size = " + imageSizeReal); LOGGER.trace(" Real Size = " + imageSizeReal);
final Vector3f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0); final Vector2f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y());
this.minSize = new Vector3f(imageBoder.x() + imageSizeReal.x(), imageBoder.y() + imageSizeReal.y(), 0); this.minSize = new Vector2f(imageBoder.x() + imageSizeReal.x(), imageBoder.y() + imageSizeReal.y());
LOGGER.trace(" set max : " + this.minSize + " min1=" + min1); LOGGER.trace(" set max : " + this.minSize + " min1=" + min1);
this.minSize = Vector3f.max(this.minSize, min1); this.minSize = Vector2f.max(this.minSize, min1);
LOGGER.trace(" result : " + this.minSize); LOGGER.trace(" result : " + this.minSize);
this.maxSize = this.propertyMaxSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0); this.maxSize = this.propertyMaxSize.getPixel().add(imageBoder.x(), imageBoder.y());
this.minSize = Vector3f.min(this.minSize, this.maxSize); this.minSize = Vector2f.min(this.minSize, this.maxSize);
} }
this.imageRenderSize = new Vector2f(this.minSize.x(), this.minSize.y()); this.imageRenderSize = new Vector2f(this.minSize.x(), this.minSize.y());
this.minSize = Vector3f.max(this.minSize, size); this.minSize = Vector2f.max(this.minSize, size);
this.maxSize = Vector3f.max(this.maxSize, this.minSize); this.maxSize = Vector2f.max(this.maxSize, this.minSize);
LOGGER.debug("set widget min=" + this.minSize + " max=" + this.maxSize + " with real Image size=" LOGGER.debug("set widget min=" + this.minSize + " max=" + this.maxSize + " with real Image size="
+ this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize); + this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize);
markToRedraw(); markToRedraw();
@ -174,16 +174,16 @@ public class ImageDisplay extends Widget {
} }
// Calculate the new position and size: // Calculate the new position and size:
Vector2f imageBoder = this.propertyBorder.getPixel(); Vector2f imageBoder = this.propertyBorder.getPixel();
Vector3f origin = new Vector3f(imageBoder.x(), imageBoder.y(), 0); Vector2f origin = new Vector2f(imageBoder.x(), imageBoder.y());
imageBoder = imageBoder.multiply(2.0f); imageBoder = imageBoder.multiply(2.0f);
Vector2f imageRealSize = this.imageRenderSize.less(imageBoder); Vector2f imageRealSize = this.imageRenderSize.less(imageBoder);
final Vector3f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y(), 0); final Vector2f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y());
final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart); final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart);
//imageRealSizeMax *= ratioSizeDisplayRequested; //imageRealSizeMax *= ratioSizeDisplayRequested;
Vector3f delta = this.propertyGravity Vector2f delta = this.propertyGravity
.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y(), 0)); .gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y()));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
imageRealSize = imageRealSize.withX(imageRealSizeMax.x()); imageRealSize = imageRealSize.withX(imageRealSizeMax.x());
delta = delta.withX(0.0f); delta = delta.withX(0.0f);
@ -206,11 +206,11 @@ public class ImageDisplay extends Widget {
} else if (ratio < ratioCurrent) { } else if (ratio < ratioCurrent) {
final float oldX = imageRealSize.x(); final float oldX = imageRealSize.x();
imageRealSize = imageRealSize.withX(imageRealSize.y() * ratio); imageRealSize = imageRealSize.withX(imageRealSize.y() * ratio);
origin = origin.add((oldX - imageRealSize.x()) * 0.5f, 0, 0); origin = origin.add((oldX - imageRealSize.x()) * 0.5f, 0);
} else { } else {
final float oldY = imageRealSize.y(); final float oldY = imageRealSize.y();
imageRealSize = imageRealSize.withY(imageRealSize.x() / ratio); imageRealSize = imageRealSize.withY(imageRealSize.x() / ratio);
origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f, 0); origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f);
} }
} }
@ -218,7 +218,7 @@ public class ImageDisplay extends Widget {
if (this.propertySmooth) { if (this.propertySmooth) {
this.compositing.setPos(origin); this.compositing.setPos(origin);
} else { } else {
this.compositing.setPos(Vector3f.clipInt(origin)); this.compositing.setPos(Vector2f.clipInt(origin));
} }
this.compositing.printPart(imageRealSize, this.propertyPosStart, this.propertyPosStop); this.compositing.printPart(imageRealSize, this.propertyPosStart, this.propertyPosStop);
LOGGER.debug("Paint Image at : " + origin + " size=" + imageRealSize); LOGGER.debug("Paint Image at : " + origin + " size=" + imageRealSize);

View File

@ -14,7 +14,7 @@ import org.atriasoft.aknot.annotation.AknotText;
import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etranslate.ETranslate; import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.AlignMode; import org.atriasoft.ewol.compositing.AlignMode;
@ -59,8 +59,8 @@ public class Label extends Widget {
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
LOGGER.trace("calculateMinMaxSize !!! data = '{}'", this.value); LOGGER.trace("calculateMinMaxSize !!! data = '{}'", this.value);
final Vector3f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
final Vector3f tmpMin = this.propertyMinSize.getPixel(); final Vector2f tmpMin = this.propertyMinSize.getPixel();
//EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} tmpMax : " + tmpMax); //EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} tmpMax : " + tmpMax);
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.textCompose.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT); this.textCompose.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT);
@ -68,14 +68,13 @@ public class Label extends Widget {
} else { } else {
this.textCompose.setTextAlignment(0, 0, AlignMode.LEFT); this.textCompose.setTextAlignment(0, 0, AlignMode.LEFT);
} }
Vector3f minSize = this.textCompose.calculateSizeDecorated(this.value); Vector2f minSize = this.textCompose.calculateSizeDecorated(this.value);
this.textCompose.flush(); this.textCompose.flush();
minSize = minSize.add(2, 2, 0); minSize = minSize.add(2, 2);
//EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} minSize : " + minSize); //EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} minSize : " + minSize);
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), // this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), //
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), // FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
10);
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize); LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
} }
@ -118,24 +117,24 @@ public class Label extends Widget {
//final int paddingSize = 2; //final int paddingSize = 2;
final Padding padding = new Padding(2, 2, 2, 2); final Padding padding = new Padding(2, 2, 2, 2);
final Vector3f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
// to know the size of one line : // to know the size of one line :
final Vector3f minSize = this.textCompose.calculateSize('A'); final Vector2f minSize = this.textCompose.calculateSize('A');
//minSize.setX(etk::max(minSize.x(), this.minSize.x())); //minSize.setX(etk::max(minSize.x(), this.minSize.x()));
//minSize.setY(etk::max(minSize.y(), this.minSize.y())); //minSize.setY(etk::max(minSize.y(), this.minSize.y()));
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.textCompose.setTextAlignment(0, tmpMax.x() - padding.x(), AlignMode.LEFT); this.textCompose.setTextAlignment(0, tmpMax.x() - padding.x(), AlignMode.LEFT);
} }
final Vector3f curentTextSize = this.textCompose.calculateSizeDecorated(this.value); final Vector2f curentTextSize = this.textCompose.calculateSizeDecorated(this.value);
//Vector3f localSize = this.minSize.clipInteger(); //Vector2f localSize = this.minSize.clipInteger();
Vector3f tmpSizeShaper = this.minSize; Vector2f tmpSizeShaper = this.minSize;
// no change for the text origin : // no change for the text origin :
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - minSize.x()) * 0.5f, Vector2f tmpTextOrigin = new Vector2f((this.size.x() - minSize.x()) * 0.5f,
(this.size.y() - minSize.y()) * 0.5f, 0); (this.size.y() - minSize.y()) * 0.5f);
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
@ -147,12 +146,8 @@ public class Label extends Widget {
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
//tmpTextOrigin = tmpTextOrigin.withY(this.size.y() - 2 * paddingSize - curentTextSize.y()); //tmpTextOrigin = tmpTextOrigin.withY(this.size.y() - 2 * paddingSize - curentTextSize.y());
} }
if (this.propertyFill.z()) { final Vector2f tmpOriginShaper = delta;
tmpSizeShaper = tmpSizeShaper.withZ(this.size.y()); final Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
delta = delta.withZ(0.0f);
}
final Vector3f tmpOriginShaper = delta;
final Vector3f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y(), padding.z());
tmpTextOrigin = tmpOriginShaper;//tmpTextOrigin.add(paddingSize, paddingSize, 0); tmpTextOrigin = tmpOriginShaper;//tmpTextOrigin.add(paddingSize, paddingSize, 0);
//localSize = localSize.less(2 * paddingSize, 2 * paddingSize, 0); //localSize = localSize.less(2 * paddingSize, 2 * paddingSize, 0);
@ -162,11 +157,11 @@ public class Label extends Widget {
.withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize); .withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize);
tmpTextOrigin = tmpTextOrigin.withX(tmpTextOrigin.x() + padding.left()); tmpTextOrigin = tmpTextOrigin.withX(tmpTextOrigin.x() + padding.left());
final Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0); final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
final Vector3f drawClippingPos = tmpOriginShaper final Vector2f drawClippingPos = tmpOriginShaper
.less(new Vector3f(padding.left(), padding.bottom(), padding.back())); .less(new Vector2f(padding.left(), padding.bottom()));
final Vector3f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1); final Vector2f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
// clean the element // clean the element
this.textCompose.reset(); this.textCompose.reset();

View File

@ -14,7 +14,7 @@ import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etranslate.ETranslate; import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.compositing.AlignMode; import org.atriasoft.ewol.compositing.AlignMode;
import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.compositing.CompositingText;
@ -67,18 +67,18 @@ public class LabelOnSVG extends Widget {
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
final Vector3f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
final Vector3f tmpMin = this.propertyMinSize.getPixel(); final Vector2f tmpMin = this.propertyMinSize.getPixel();
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax); LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT); this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT);
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement "); LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement ");
} }
final Vector3f minSize = this.text.calculateSizeDecorated(this.value); final Vector2f minSize = this.text.calculateSizeDecorated(this.value);
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize); LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()),
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z())); FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < " LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < "
+ this.minSize + " < " + tmpMax); + this.minSize + " < " + tmpMax);
} }
@ -121,22 +121,22 @@ public class LabelOnSVG extends Widget {
this.text.clear(); this.text.clear();
final int paddingSize = 2; final int paddingSize = 2;
final Vector3f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
// to know the size of one line : // to know the size of one line :
final Vector3f minSize = this.text.calculateSize('A'); final Vector2f minSize = this.text.calculateSize('A');
//minSize.setX(etk::max(minSize.x(), this.minSize.x())); //minSize.setX(etk::max(minSize.x(), this.minSize.x()));
//minSize.setY(etk::max(minSize.y(), this.minSize.y())); //minSize.setY(etk::max(minSize.y(), this.minSize.y()));
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT); this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT);
} }
final Vector3f currentTextSize = this.text.calculateSizeDecorated(this.value); final Vector2f currentTextSize = this.text.calculateSizeDecorated(this.value);
Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y()); Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y());
// no change for the text origin : // no change for the text origin :
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - this.minSize.x()) / 2.0f, Vector2f tmpTextOrigin = new Vector2f((this.size.x() - this.minSize.x()) / 2.0f,
(this.size.y() - this.minSize.y()) / 2.0f, 0); (this.size.y() - this.minSize.y()) / 2.0f);
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
localSize = localSize.withX((int) this.size.x()); localSize = localSize.withX((int) this.size.x());
@ -146,15 +146,15 @@ public class LabelOnSVG extends Widget {
localSize = localSize.withY((int) this.size.y()); localSize = localSize.withY((int) this.size.y());
tmpTextOrigin = tmpTextOrigin.withY(this.size.y() - 2 * paddingSize - currentTextSize.y()); tmpTextOrigin = tmpTextOrigin.withY(this.size.y() - 2 * paddingSize - currentTextSize.y());
} }
tmpTextOrigin = tmpTextOrigin.add(paddingSize, paddingSize, 0); tmpTextOrigin = tmpTextOrigin.add(paddingSize, paddingSize);
localSize = localSize.less(2 * paddingSize, 2 * paddingSize); localSize = localSize.less(2 * paddingSize, 2 * paddingSize);
tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y()); tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y());
final Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0); final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
final Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f); final Vector2f drawClippingPos = new Vector2f(paddingSize, paddingSize);
final Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1); final Vector2f drawClippingSize = new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize));
// clean the element // clean the element
this.text.reset(); this.text.reset();

View File

@ -5,7 +5,7 @@
*/ */
package org.atriasoft.ewol.widget; package org.atriasoft.ewol.widget;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
@ -19,7 +19,7 @@ class Layer extends ContainerN {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (this.propertyHide) { if (this.propertyHide) {
return null; return null;
} }
@ -28,8 +28,8 @@ class Layer extends ContainerN {
if (it == null) { if (it == null) {
continue; continue;
} }
final Vector3f tmpSize = it.getSize(); final Vector2f tmpSize = it.getSize();
final Vector3f tmpOrigin = it.getOrigin(); final Vector2f tmpOrigin = it.getOrigin();
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) { if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
final Widget tmpWidget = it.getWidgetAtPos(pos); final Widget tmpWidget = it.getWidgetAtPos(pos);
if (tmpWidget != null) { if (tmpWidget != null) {

View File

@ -26,8 +26,8 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.resource.ResourceColorFile; import org.atriasoft.ewol.resource.ResourceColorFile;
import org.atriasoft.ewol.widget.model.ListRole; import org.atriasoft.ewol.widget.model.ListRole;
@ -235,7 +235,7 @@ public class ListFileSystem extends WidgetList {
} }
@Override @Override
protected boolean onItemEvent(final EventInput event, final Vector3i pos, final Vector3f mousePosition) { protected boolean onItemEvent(final EventInput event, final Vector2i pos, final Vector2f mousePosition) {
int offset = 0; int offset = 0;
if (this.propertyShowFolder) { if (this.propertyShowFolder) {
if (this.propertyPath.equals("/")) { if (this.propertyPath.equals("/")) {

View File

@ -9,10 +9,10 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance; import org.atriasoft.etk.Distance;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.gale.key.KeyStatus; import org.atriasoft.gale.key.KeyStatus;
@ -28,8 +28,8 @@ public class PopUp extends Box {
*/ */
public PopUp() { public PopUp() {
//super(new Uri("THEME", "shape/PopUp.json", "ewol")); //super(new Uri("THEME", "shape/PopUp.json", "ewol"));
this.propertyMinSize = new Dimension3f(new Vector3f(80, 80, 20), Distance.POURCENT); this.propertyMinSize = new Dimension2f(new Vector2f(80, 80), Distance.POURCENT);
this.propertyExpand = Vector3b.FALSE; this.propertyExpand = Vector2b.FALSE;
} }
@AknotManaged @AknotManaged
@ -52,7 +52,7 @@ public class PopUp extends Box {
return false; return false;
} }
final Vector3f pos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); final Vector2f pos = relativePosition(event.pos());
// if (!this.shapeProperty.isInside(pos)) { // if (!this.shapeProperty.isInside(pos)) {
// autoDestroy(); // autoDestroy();
// return true; // return true;

View File

@ -10,7 +10,7 @@ import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.compositing.CompositingDrawing;
class ProgressBar extends Widget { class ProgressBar extends Widget {
@ -28,8 +28,8 @@ class ProgressBar extends Widget {
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
final Vector3f tmpMin = this.propertyMinSize.getPixel(); final Vector2f tmpMin = this.propertyMinSize.getPixel();
this.minSize = new Vector3f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f), 10); this.minSize = new Vector2f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f));
markToRedraw(); markToRedraw();
} }
@ -85,11 +85,11 @@ class ProgressBar extends Widget {
final int tmpOriginX = 5; final int tmpOriginX = 5;
final int tmpOriginY = 5; final int tmpOriginY = 5;
this.draw.setColor(this.propertyTextColorBgOn); this.draw.setColor(this.propertyTextColorBgOn);
this.draw.setPos(new Vector3f(tmpOriginX, tmpOriginY, 0)); this.draw.setPos(new Vector2f(tmpOriginX, tmpOriginY));
this.draw.rectangleWidth(new Vector3f(tmpSizeX * this.propertyValue, tmpSizeY, 0)); this.draw.rectangleWidth(new Vector2f(tmpSizeX * this.propertyValue, tmpSizeY));
this.draw.setColor(this.propertyTextColorBgOff); this.draw.setColor(this.propertyTextColorBgOff);
this.draw.setPos(new Vector3f(tmpOriginX + tmpSizeX * this.propertyValue, tmpOriginY, 0)); this.draw.setPos(new Vector2f(tmpOriginX + tmpSizeX * this.propertyValue, tmpOriginY));
this.draw.rectangleWidth(new Vector3f(tmpSizeX * (1.0f - this.propertyValue), tmpSizeY, 0)); this.draw.rectangleWidth(new Vector2f(tmpSizeX * (1.0f - this.propertyValue), tmpSizeY));
// TODO : Create a better progress Bar ... // TODO : Create a better progress Bar ...
//this.draw.setColor(propertyTextColorFg); //this.draw.setColor(propertyTextColorFg);

View File

@ -13,8 +13,8 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.GravityVertical; import org.atriasoft.ewol.GravityVertical;
import org.atriasoft.ewol.HighSpeedMode; import org.atriasoft.ewol.HighSpeedMode;
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
class Scroll extends Container { class Scroll extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Scroll.class); private static final Logger LOGGER = LoggerFactory.getLogger(Scroll.class);
protected static final int SCROLL_BAR_SPACE = 15; protected static final int SCROLL_BAR_SPACE = 15;
protected Vector3f propertyLimit = new Vector3f(0.15f, 0.5f, 0.0f); //!< Set the limitation of the ratio in the screen protected Vector2f propertyLimit = new Vector2f(0.15f, 0.5f); //!< Set the limitation of the ratio in the screen
protected Uri propertyShapeVert = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Vertical shaper name protected Uri propertyShapeVert = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Vertical shaper name
@ -40,7 +40,7 @@ class Scroll extends Container {
protected CompositingSVG compositingH = new CompositingSVG(); protected CompositingSVG compositingH = new CompositingSVG();
protected CompositingSVG compositingV = new CompositingSVG(); protected CompositingSVG compositingV = new CompositingSVG();
protected float pixelScrolling = 20; protected float pixelScrolling = 20;
protected Vector3f highSpeedStartPos = Vector3f.ZERO; protected Vector2f highSpeedStartPos = Vector2f.ZERO;
protected HighSpeedMode highSpeedMode = HighSpeedMode.speedModeDisable; protected HighSpeedMode highSpeedMode = HighSpeedMode.speedModeDisable;
protected int highSpeedButton = -1; protected int highSpeedButton = -1;
protected KeyType highSpeedType = KeyType.unknow; protected KeyType highSpeedType = KeyType.unknow;
@ -64,7 +64,7 @@ class Scroll extends Container {
@AknotAttribute @AknotAttribute
@AknotName(value = "limit") @AknotName(value = "limit")
@AknotDescription(value = "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end") @AknotDescription(value = "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end")
public Vector3f getPropertyLimit() { public Vector2f getPropertyLimit() {
return this.propertyLimit; return this.propertyLimit;
} }
@ -85,7 +85,7 @@ class Scroll extends Container {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
final Widget tmpWidget = super.getWidgetAtPos(pos); final Widget tmpWidget = super.getWidgetAtPos(pos);
if (tmpWidget != null) { if (tmpWidget != null) {
return tmpWidget; return tmpWidget;
@ -126,14 +126,14 @@ class Scroll extends Container {
return; return;
} }
// remove the bar if hover // remove the bar if hover
Vector3f basicSize = this.size; Vector2f basicSize = this.size;
if (!this.propertyHover) { if (!this.propertyHover) {
basicSize = basicSize.less(SCROLL_BAR_SPACE, SCROLL_BAR_SPACE, SCROLL_BAR_SPACE); basicSize = basicSize.less(SCROLL_BAR_SPACE, SCROLL_BAR_SPACE);
} }
Vector3f origin = this.origin.add(this.offset); Vector2f origin = this.origin.add(this.offset);
Vector3f minSize = this.subWidget.getCalculateMinSize(); Vector2f minSize = this.subWidget.getCalculateMinSize();
final Vector3b expand = this.subWidget.propertyExpand; final Vector2b expand = this.subWidget.propertyExpand;
//The gravity is not set on the sub element ==> special use of the widget //The gravity is not set on the sub element ==> special use of the widget
//origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - this.size); //origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - this.size);
if (expand.x() && minSize.x() < basicSize.x()) { if (expand.x() && minSize.x() < basicSize.x()) {
@ -144,9 +144,9 @@ class Scroll extends Container {
} }
this.subWidget.setSize(minSize); this.subWidget.setSize(minSize);
if (this.propertyGravity.y() == GravityVertical.TOP) { if (this.propertyGravity.y() == GravityVertical.TOP) {
origin = origin.add(0.0f, basicSize.y() - minSize.y(), 0); origin = origin.add(0.0f, basicSize.y() - minSize.y());
if (!this.propertyHover) { if (!this.propertyHover) {
origin = origin.add(0, SCROLL_BAR_SPACE, 0); origin = origin.add(0, SCROLL_BAR_SPACE);
} }
} else if (this.propertyGravity.y() == GravityVertical.BOTTOM) { } else if (this.propertyGravity.y() == GravityVertical.BOTTOM) {
// nothing to do ... origin += // nothing to do ... origin +=
@ -167,9 +167,9 @@ class Scroll extends Container {
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
//ewol::event::Input _event = event; //ewol::event::Input _event = event;
//_event.setType(KeyType.finger); //_event.setType(KeyType.finger);
Vector3f relativePos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); Vector2f relativePos = relativePosition(new Vector2f(event.pos().x(), event.pos().y()));
Vector3f scrollOffset = Vector3f.ZERO; Vector2f scrollOffset = Vector2f.ZERO;
Vector3f scrollSize = Vector3f.ZERO; Vector2f scrollSize = Vector2f.ZERO;
if (this.subWidget != null) { if (this.subWidget != null) {
scrollOffset = this.subWidget.getOffset(); scrollOffset = this.subWidget.getOffset();
scrollSize = this.subWidget.getSize(); scrollSize = this.subWidget.getSize();
@ -248,7 +248,7 @@ class Scroll extends Container {
if (event.status() == KeyStatus.down) { if (event.status() == KeyStatus.down) {
this.highSpeedMode = HighSpeedMode.speedModeInit; this.highSpeedMode = HighSpeedMode.speedModeInit;
this.highSpeedType = KeyType.mouse; this.highSpeedType = KeyType.mouse;
this.highSpeedStartPos = new Vector3f(relativePos.x(), relativePos.y(), 0); this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
this.highSpeedButton = 2; this.highSpeedButton = 2;
// not really use... == > just keep some informations // not really use... == > just keep some informations
return false; return false;
@ -344,7 +344,7 @@ class Scroll extends Container {
if (KeyStatus.down == event.status()) { if (KeyStatus.down == event.status()) {
this.highSpeedMode = HighSpeedMode.speedModeInit; this.highSpeedMode = HighSpeedMode.speedModeInit;
this.highSpeedType = KeyType.finger; this.highSpeedType = KeyType.finger;
this.highSpeedStartPos = new Vector3f(relativePos.x(), relativePos.y(), 0); this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
LOGGER.trace("SCROOL == > INIT pos=" + this.highSpeedStartPos + " && curent scrollOffset=" LOGGER.trace("SCROOL == > INIT pos=" + this.highSpeedStartPos + " && curent scrollOffset="
+ scrollOffset); + scrollOffset);
return true; return true;
@ -420,8 +420,8 @@ class Scroll extends Container {
this.compositingV.clear(); this.compositingV.clear();
final Padding paddingVert = new Padding(2, 2, 2, 2); // this.compositingV.getPadding(); final Padding paddingVert = new Padding(2, 2, 2, 2); // this.compositingV.getPadding();
final Padding paddingHori = new Padding(2, 2, 2, 2); // this.compositingH.getPadding(); final Padding paddingHori = new Padding(2, 2, 2, 2); // this.compositingH.getPadding();
Vector3f scrollOffset = Vector3f.ZERO; Vector2f scrollOffset = Vector2f.ZERO;
Vector3f scrollSize = Vector3f.ZERO; Vector2f scrollSize = Vector2f.ZERO;
if (this.subWidget != null) { if (this.subWidget != null) {
scrollOffset = this.subWidget.getOffset(); scrollOffset = this.subWidget.getOffset();
scrollSize = this.subWidget.getSize(); scrollSize = this.subWidget.getSize();
@ -474,8 +474,8 @@ class Scroll extends Container {
this.propertyHover = propertyHover; this.propertyHover = propertyHover;
} }
public void setPropertyLimit(final Vector3f propertyLimit) { public void setPropertyLimit(final Vector2f propertyLimit) {
final Vector3f tmp = Vector3f.avg(Vector3f.ZERO, propertyLimit, Vector3f.ONE); final Vector2f tmp = Vector2f.avg(Vector2f.ZERO, propertyLimit, Vector2f.ONE);
if (tmp.equals(this.propertyLimit)) { if (tmp.equals(this.propertyLimit)) {
return; return;
} }

View File

@ -10,11 +10,11 @@ import org.atriasoft.aknot.annotation.AknotCaseSensitive;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -27,7 +27,7 @@ public class Sizer extends ContainerN {
VERTICAL; //!< Vertical mode VERTICAL; //!< Vertical mode
} }
protected Dimension3f propertyBorderSize = Dimension3f.ZERO; //!< Border size needed for all the display protected Dimension2f propertyBorderSize = Dimension2f.ZERO; //!< Border size needed for all the display
protected DisplayMode propertyMode = DisplayMode.HORIZONTAL; //!< Method to display the widget list (vert/hory ...) protected DisplayMode propertyMode = DisplayMode.HORIZONTAL; //!< Method to display the widget list (vert/hory ...)
/** /**
@ -48,9 +48,9 @@ public class Sizer extends ContainerN {
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
LOGGER.trace("[" + getId() + "] update minimum size"); LOGGER.trace("[" + getId() + "] update minimum size");
this.subExpend = Vector3b.FALSE; this.subExpend = Vector2b.FALSE;
this.minSize = this.propertyMinSize.getPixel(); this.minSize = this.propertyMinSize.getPixel();
final Vector3f tmpBorderSize = this.propertyBorderSize.getPixel(); final Vector2f tmpBorderSize = this.propertyBorderSize.getPixel();
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} set min size : " + this.minSize); LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} set min size : " + this.minSize);
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it == null) { if (it == null) {
@ -63,7 +63,7 @@ public class Sizer extends ContainerN {
if (it.canExpand().y()) { if (it.canExpand().y()) {
this.subExpend = this.subExpend.withY(true); this.subExpend = this.subExpend.withY(true);
} }
final Vector3f tmpSize = it.getCalculateMinSize(); final Vector2f tmpSize = it.getCalculateMinSize();
LOGGER.trace("[" + getId() + "] NewMinSize=" + tmpSize); LOGGER.trace("[" + getId() + "] NewMinSize=" + tmpSize);
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize); LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize);
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
@ -86,7 +86,7 @@ public class Sizer extends ContainerN {
@AknotAttribute @AknotAttribute
@AknotName("border") @AknotName("border")
@AknotDescription("The sizer border size") @AknotDescription("The sizer border size")
public Dimension3f getPropertyBorderSize() { public Dimension2f getPropertyBorderSize() {
return this.propertyBorderSize; return this.propertyBorderSize;
} }
@ -101,31 +101,29 @@ public class Sizer extends ContainerN {
@Override @Override
public void onChangeSize() { public void onChangeSize() {
super.onChangeSize(); super.onChangeSize();
final Vector3f tmpBorderSize = this.propertyBorderSize.getPixel(); final Vector2f tmpBorderSize = this.propertyBorderSize.getPixel();
LOGGER.trace("[" + getId() + "] update size : " + this.size + " nbElement : " + this.subWidget.size() LOGGER.trace("[" + getId() + "] update size : " + this.size + " nbElement : " + this.subWidget.size()
+ " borderSize=" + tmpBorderSize + " from border=" + this.propertyBorderSize); + " borderSize=" + tmpBorderSize + " from border=" + this.propertyBorderSize);
final Vector3f localWidgetSize = this.size.less(tmpBorderSize.multiply(2.0f)); final Vector2f localWidgetSize = this.size.less(tmpBorderSize.multiply(2.0f));
// -1- calculate min-size and expand requested: // -1- calculate min-size and expand requested:
Vector3f minSize = Vector3f.ZERO; Vector2f minSize = Vector2f.ZERO;
Vector3i nbWidgetExpand = Vector3i.ZERO; Vector2i nbWidgetExpand = Vector2i.ZERO;
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
final Vector3f tmpSize = it.getCalculateMinSize(); final Vector2f tmpSize = it.getCalculateMinSize();
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
minSize = new Vector3f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y(), minSize = new Vector2f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y());
Math.max(minSize.z(), tmpSize.z()));
} else { } else {
minSize = new Vector3f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()), minSize = new Vector2f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()));
Math.max(minSize.z(), tmpSize.z()));
} }
final Vector3b expand = it.canExpand(); final Vector2b expand = it.canExpand();
nbWidgetExpand = nbWidgetExpand.add(expand.x() ? 1 : 0, expand.y() ? 1 : 0, 0); nbWidgetExpand = nbWidgetExpand.add(expand.x() ? 1 : 0, expand.y() ? 1 : 0);
} }
// -2- Calculate the size to add at every elements... // -2- Calculate the size to add at every elements...
float deltaExpandSize = 0.0f; float deltaExpandSize = 0.0f;
if (!nbWidgetExpand.isEqual(Vector3i.ZERO)) { if (!nbWidgetExpand.isEqual(Vector2i.ZERO)) {
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
deltaExpandSize = (localWidgetSize.y() - minSize.y()) / (nbWidgetExpand.y()); deltaExpandSize = (localWidgetSize.y() - minSize.y()) / (nbWidgetExpand.y());
} else { } else {
@ -159,8 +157,8 @@ public class Sizer extends ContainerN {
if (it == null) { if (it == null) {
continue; continue;
} }
Vector3f tmpSizeMin = it.getSize(); Vector2f tmpSizeMin = it.getSize();
final Vector3f tmpSizeMax = it.getCalculateMaxSize(); final Vector2f tmpSizeMax = it.getCalculateMaxSize();
// Now update his size his size in X and the current sizer size in Y: // Now update his size his size in X and the current sizer size in Y:
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
if (it.canExpand().y() || (it == lastWidget && it.canExpandIfFree().y())) { if (it.canExpand().y() || (it == lastWidget && it.canExpandIfFree().y())) {
@ -214,7 +212,7 @@ public class Sizer extends ContainerN {
if (!it.canExpand().x() && !it.canExpandIfFree().x()) { if (!it.canExpand().x() && !it.canExpandIfFree().x()) {
continue; continue;
} }
Vector3f tmpSizeMin = it.getSize(); Vector2f tmpSizeMin = it.getSize();
tmpSizeMin = tmpSizeMin tmpSizeMin = tmpSizeMin
.withX(FMath.avg(tmpSizeMin.x(), localWidgetSize.x(), it.getCalculateMaxSize().x())); .withX(FMath.avg(tmpSizeMin.x(), localWidgetSize.x(), it.getCalculateMaxSize().x()));
it.setSize(tmpSizeMin); it.setSize(tmpSizeMin);
@ -222,7 +220,7 @@ public class Sizer extends ContainerN {
if (!it.canExpand().y() && !it.canExpandIfFree().y()) { if (!it.canExpand().y() && !it.canExpandIfFree().y()) {
continue; continue;
} }
Vector3f tmpSizeMin = it.getSize(); Vector2f tmpSizeMin = it.getSize();
tmpSizeMin = tmpSizeMin tmpSizeMin = tmpSizeMin
.withY(FMath.avg(tmpSizeMin.y(), localWidgetSize.y(), it.getCalculateMaxSize().y())); .withY(FMath.avg(tmpSizeMin.y(), localWidgetSize.y(), it.getCalculateMaxSize().y()));
it.setSize(tmpSizeMin); it.setSize(tmpSizeMin);
@ -233,40 +231,38 @@ public class Sizer extends ContainerN {
if (it == null) { if (it == null) {
continue; continue;
} }
it.setSize(Vector3f.clipInt(it.getSize())); it.setSize(Vector2f.clipInt(it.getSize()));
} }
// -7- get under Size // -7- get under Size
Vector3f underSize = Vector3f.ZERO; Vector2f underSize = Vector2f.ZERO;
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
final Vector3f size = it.getSize(); final Vector2f size = it.getSize();
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
underSize = new Vector3f(Math.max(underSize.x(), size.x()), underSize.y() + size.y(), underSize = new Vector2f(Math.max(underSize.x(), size.x()), underSize.y() + size.y());
Math.max(underSize.z(), size.z()));
} else { } else {
underSize = new Vector3f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()), underSize = new Vector2f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()));
Math.max(underSize.z(), size.z()));
} }
} }
final Vector3f deltas = localWidgetSize.less(underSize); final Vector2f deltas = localWidgetSize.less(underSize);
// -8- Calculate the local origin, depending of the gravity: // -8- Calculate the local origin, depending of the gravity:
Vector3f tmpOrigin = this.origin.add(tmpBorderSize).add(this.propertyGravity.gravityGenerateDelta(deltas)); Vector2f tmpOrigin = this.origin.add(tmpBorderSize).add(this.propertyGravity.gravityGenerateDelta(deltas));
// -9- Set sub widget origin: // -9- Set sub widget origin:
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
Vector3f origin; Vector2f origin;
final Vector3f size = it.getSize(); final Vector2f size = it.getSize();
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add( origin = Vector2f.clipInt(tmpOrigin.add(this.offset).add(
this.propertyGravity.gravityGenerateDelta(new Vector3f(underSize.x() - size.x(), 0.0f, 0.0f)))); this.propertyGravity.gravityGenerateDelta(new Vector2f(underSize.x() - size.x(), 0.0f))));
} else { } else {
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add( origin = Vector2f.clipInt(tmpOrigin.add(this.offset).add(
this.propertyGravity.gravityGenerateDelta(new Vector3f(0.0f, underSize.y() - size.y(), 0.0f)))); this.propertyGravity.gravityGenerateDelta(new Vector2f(0.0f, underSize.y() - size.y()))));
} }
it.setOrigin(origin); it.setOrigin(origin);
if (this.propertyMode == DisplayMode.VERTICAL) { if (this.propertyMode == DisplayMode.VERTICAL) {
@ -285,7 +281,7 @@ public class Sizer extends ContainerN {
markToRedraw(); markToRedraw();
} }
public void setPropertyBorderSize(final Dimension3f propertyBorderSize) { public void setPropertyBorderSize(final Dimension2f propertyBorderSize) {
if (this.propertyBorderSize.equals(propertyBorderSize)) { if (this.propertyBorderSize.equals(propertyBorderSize)) {
return; return;
} }

View File

@ -10,8 +10,8 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.CompositingSVG; import org.atriasoft.ewol.compositing.CompositingSVG;
@ -41,12 +41,12 @@ public class Slider extends Widget {
@AknotDescription("Tick value change") @AknotDescription("Tick value change")
public Signal<Float> signalValue = new Signal<>(); public Signal<Float> signalValue = new Signal<>();
// element over: // element over:
Vector3f overPositionStart = Vector3f.ZERO; Vector2f overPositionStart = Vector2f.ZERO;
Vector3f overPositionStop = Vector3f.ZERO; Vector2f overPositionStop = Vector2f.ZERO;
Vector3f overPositionSize = Vector3f.ZERO; Vector2f overPositionSize = Vector2f.ZERO;
Vector3f overCursorPositionStart = Vector3f.ZERO; Vector2f overCursorPositionStart = Vector2f.ZERO;
Vector3f overCursorPositionStop = Vector3f.ZERO; Vector2f overCursorPositionStop = Vector2f.ZERO;
Vector3f overCursorPositionSize = Vector3f.ZERO; Vector2f overCursorPositionSize = Vector2f.ZERO;
//@AknotAutoGenerateProperty("minimum", "configuration of the widget") //@AknotAutoGenerateProperty("minimum", "configuration of the widget")
private Float propertyMinimum = 0.0f; private Float propertyMinimum = 0.0f;
@ -75,19 +75,19 @@ public class Slider extends Widget {
super.calculateMinMaxSize(); super.calculateMinMaxSize();
// get generic padding // get generic padding
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
final Vector3i minHeight = Vector3i.VALUE_16; final Vector2i minHeight = Vector2i.VALUE_16;
Vector3f minimumSizeBase = new Vector3f(minHeight.x(), minHeight.y(), minHeight.z()); Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
// add padding : // add padding :
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y(), padding.z()); minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
this.minSize = Vector3f.max(this.minSize, minimumSizeBase); this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
LOGGER.error("min size = " + this.minSize); LOGGER.error("min size = " + this.minSize);
} }
private boolean checkIfOver(final Vector3f relPos) { private boolean checkIfOver(final Vector2f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y()
&& relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y(); && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
} }
@ -147,8 +147,8 @@ public class Slider extends Widget {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
final Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0); final Vector2f positionAbsolute = new Vector2f(event.pos().x(), event.pos().y());
final Vector3f relPos = relativePosition(positionAbsolute); final Vector2f relPos = relativePosition(positionAbsolute);
LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos); LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = checkIfOver(relPos); final boolean over = checkIfOver(relPos);
if (event.inputId() != 1) { if (event.inputId() != 1) {
@ -224,8 +224,8 @@ public class Slider extends Widget {
final Padding padding = Padding.ZERO;//this.shape.getPadding(); final Padding padding = Padding.ZERO;//this.shape.getPadding();
{ {
// Manage external shape: // Manage external shape:
Vector3f tmpSizeShaper = this.minSize; Vector2f tmpSizeShaper = this.minSize;
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
delta = delta.withX(0.0f); delta = delta.withX(0.0f);
@ -235,16 +235,16 @@ public class Slider extends Widget {
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
} }
Vector3f tmpOriginShaper = delta; Vector2f tmpOriginShaper = delta;
Vector3f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y(), padding.z()); Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
//Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f); //Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector3f tmpOriginInside = Vector3f.ZERO; Vector2f tmpOriginInside = Vector2f.ZERO;
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ... // sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
// fix all the position in the int class: // fix all the position in the int class:
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper); tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper); tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
tmpSizeInside = Vector3f.clipInt(tmpSizeInside); tmpSizeInside = Vector2f.clipInt(tmpSizeInside);
tmpOriginInside = Vector3f.clipInt(tmpOriginInside); tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
this.overPositionStart = tmpOriginShaper; this.overPositionStart = tmpOriginShaper;
this.overPositionSize = tmpSizeShaper; this.overPositionSize = tmpSizeShaper;
@ -253,17 +253,17 @@ public class Slider extends Widget {
} }
{ {
// Manage cursor: // Manage cursor:
Vector3f tmpSizeShaper = this.minSize; Vector2f tmpSizeShaper = this.minSize;
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.y()) { if (this.propertyFill.y()) {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y()); tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
} }
Vector3f tmpOriginShaper = delta; Vector2f tmpOriginShaper = delta;
Vector3f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y(), padding.z()); Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
//Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f); //Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector3f tmpOriginInside = Vector3f.ZERO; Vector2f tmpOriginInside = Vector2f.ZERO;
final float xxx = tmpOriginShaper.x() * 2.0f; final float xxx = tmpOriginShaper.x() * 2.0f;
@ -271,10 +271,10 @@ public class Slider extends Widget {
xxx * (this.propertyValue - this.propertyMinimum) / (this.propertyMaximum - this.propertyMinimum)); xxx * (this.propertyValue - this.propertyMinimum) / (this.propertyMaximum - this.propertyMinimum));
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ... // sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
// fix all the position in the int class: // fix all the position in the int class:
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper); tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper); tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
tmpSizeInside = Vector3f.clipInt(tmpSizeInside); tmpSizeInside = Vector2f.clipInt(tmpSizeInside);
tmpOriginInside = Vector3f.clipInt(tmpOriginInside); tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
this.overCursorPositionStart = tmpOriginShaper; this.overCursorPositionStart = tmpOriginShaper;
this.overCursorPositionSize = tmpSizeShaper; this.overCursorPositionSize = tmpSizeShaper;

View File

@ -12,7 +12,7 @@ import org.atriasoft.aknot.annotation.AknotName;
*/ */
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.compositing.CompositingDrawing;
public class Spacer extends Widget { public class Spacer extends Widget {
@ -35,7 +35,7 @@ public class Spacer extends Widget {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
return null; return null;
} }
@ -55,10 +55,10 @@ public class Spacer extends Widget {
return; return;
} }
this.draw.setColor(this.propertyColor); this.draw.setColor(this.propertyColor);
this.draw.setPos(Vector3f.ZERO); this.draw.setPos(Vector2f.ZERO);
this.draw.rectangleWidth(new Vector3f(this.size.x(), this.size.y(), 0)); this.draw.rectangleWidth(new Vector2f(this.size.x(), this.size.y()));
//this.draw.setPos(new Vector3f(this.size.x() * 0.1f, this.size.y() * 0.1f, 0)); //this.draw.setPos(new Vector2f(this.size.x() * 0.1f, this.size.y() * 0.1f, 0));
//this.draw.rectangleWidth(new Vector3f(this.size.x() * 0.8f, this.size.y() * 0.8f, 0)); //this.draw.rectangleWidth(new Vector2f(this.size.x() * 0.8f, this.size.y() * 0.8f, 0));
this.draw.flush(); this.draw.flush();
} }

View File

@ -11,12 +11,12 @@ import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingSVG; import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.compositing.GuiShapeMode; import org.atriasoft.ewol.compositing.GuiShapeMode;
@ -77,8 +77,8 @@ public class Tick extends Box {
@AknotDescription("Tick value change") @AknotDescription("Tick value change")
public Signal<Boolean> signalValue = new Signal<>(); public Signal<Boolean> signalValue = new Signal<>();
// element over: // element over:
Vector3f overPositionStart = Vector3f.ZERO; Vector2f overPositionStart = Vector2f.ZERO;
Vector3f overPositionStop = Vector3f.ZERO; Vector2f overPositionStop = Vector2f.ZERO;
private boolean isDown; private boolean isDown;
@ -90,9 +90,9 @@ public class Tick extends Box {
markToRedraw(); markToRedraw();
// can not support multiple click... // can not support multiple click...
setMouseLimit(1); setMouseLimit(1);
setPropertyExpand(Vector3b.FALSE); setPropertyExpand(Vector2b.FALSE);
setPropertyFill(Vector3b.TRUE); setPropertyFill(Vector2b.TRUE);
setPropertyMinSize(new Dimension3f(new Vector3f(32f, 32f, 32f))); setPropertyMinSize(new Dimension2f(new Vector2f(32f, 32f)));
setPropertyBorderWidth(new Dimension1f(4)); setPropertyBorderWidth(new Dimension1f(4));
//setPropertyBorderRadius(new Dimension1f(15)); //setPropertyBorderRadius(new Dimension1f(15));
setPropertyBorderColor(Color.BLACK); setPropertyBorderColor(Color.BLACK);
@ -108,12 +108,12 @@ public class Tick extends Box {
super.calculateMinMaxSize(); super.calculateMinMaxSize();
// get generic padding // get generic padding
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
final Vector3i minHeight = Vector3i.VALUE_16; final Vector2i minHeight = Vector2i.VALUE_16;
Vector3f minimumSizeBase = new Vector3f(minHeight.x(), minHeight.y(), minHeight.z()); Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
// add padding : // add padding :
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y(), padding.z()); minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
this.minSize = Vector3f.max(this.minSize, minimumSizeBase); this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
LOGGER.error("min size = " + this.minSize); LOGGER.error("min size = " + this.minSize);
@ -130,7 +130,7 @@ public class Tick extends Box {
// } // }
} }
private boolean checkIfOver(final Vector3f relPos) { private boolean checkIfOver(final Vector2f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y()
&& relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y(); && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
} }
@ -167,8 +167,8 @@ public class Tick extends Box {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
final Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0); final Vector2f positionAbsolute = new Vector2f(event.pos().x(), event.pos().y());
final Vector3f relPos = relativePosition(positionAbsolute); final Vector2f relPos = relativePosition(positionAbsolute);
System.out.println("Event on Input ... " + event + " relPos = " + relPos); System.out.println("Event on Input ... " + event + " relPos = " + relPos);
LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos); LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = checkIfOver(relPos); final boolean over = checkIfOver(relPos);

View File

@ -16,12 +16,13 @@ import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.aknot.annotation.AknotSignal; import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.Signal;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance; import org.atriasoft.etk.Distance;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
@ -74,23 +75,23 @@ public class Widget extends EwolObject {
private final List<EventShortCut> localShortcut = new ArrayList<>(); //!< list of all shortcut in the widget private final List<EventShortCut> localShortcut = new ArrayList<>(); //!< list of all shortcut in the widget
protected Vector3f maxSize = Vector3f.MAX_VALUE; //!< internal: maximum size of the widget protected Vector2f maxSize = Vector2f.MAX_VALUE; //!< internal: maximum size of the widget
protected Vector3f minSize = Vector3f.ZERO; //!< internal: minimum size of the widget protected Vector2f minSize = Vector2f.ZERO; //!< internal: minimum size of the widget
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
protected boolean needRegenerateDisplay = true; //!< the display might be done the next regeneration protected boolean needRegenerateDisplay = true; //!< the display might be done the next regeneration
protected Vector3f offset = Vector3f.ZERO; //!< Offset of the display in the view-port protected Vector2f offset = Vector2f.ZERO; //!< Offset of the display in the view-port
protected Vector3f origin = Vector3f.ZERO; //!< internal ... I do not really known how if can use it ... protected Vector2f origin = Vector2f.ZERO; //!< internal ... I do not really known how if can use it ...
protected boolean propertyCanFocus = false; //!< the focus can be done on this widget protected boolean propertyCanFocus = false; //!< the focus can be done on this widget
protected Vector3b propertyExpand = Vector3b.FALSE; //!< the widget will expand if possible protected Vector2b propertyExpand = Vector2b.FALSE; //!< the widget will expand if possible
protected Vector3b propertyExpandIfFree = Vector3b.FALSE; //!< the widget will expand if possible protected Vector2b propertyExpandIfFree = Vector2b.FALSE; //!< the widget will expand if possible
protected Vector3b propertyFill = Vector3b.FALSE; //!< the widget will fill all the space provided by the parent. protected Vector2b propertyFill = Vector2b.FALSE; //!< the widget will fill all the space provided by the parent.
protected Gravity propertyGravity = Gravity.CENTER; //!< Gravity of the widget protected Gravity propertyGravity = Gravity.CENTER; //!< Gravity of the widget
protected boolean propertyHide = false; //!< hide a widget on the display protected boolean propertyHide = false; //!< hide a widget on the display
protected Dimension3f propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget protected Dimension2f propertyMaxSize = new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget
protected Dimension3f propertyMinSize = new Dimension3f(Vector3f.ZERO, Distance.PIXEL); //!< user define the minimum size of the widget protected Dimension2f propertyMinSize = new Dimension2f(Vector2f.ZERO, Distance.PIXEL); //!< user define the minimum size of the widget
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Shortcut : management of the shortcut // -- Shortcut : management of the shortcut
@ -102,7 +103,7 @@ public class Widget extends EwolObject {
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Widget size: // -- Widget size:
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
protected Vector3f size = Vector3f.VALUE_16; //!< internal: current size of the widget protected Vector2f size = Vector2f.VALUE_16; //!< internal: current size of the widget
// internal element calculated by the system // internal element calculated by the system
protected float zoom = 1.0f; //!< generic widget zoom protected float zoom = 1.0f; //!< generic widget zoom
@ -135,11 +136,11 @@ public class Widget extends EwolObject {
* @return 2D boolean represents the capacity to expend * @return 2D boolean represents the capacity to expend
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3b canExpand() { public Vector2b canExpand() {
if (!this.propertyHide) { if (!this.propertyHide) {
return this.propertyExpand; return this.propertyExpand;
} }
return Vector3b.FALSE; return Vector2b.FALSE;
} }
/** /**
@ -147,19 +148,19 @@ public class Widget extends EwolObject {
* @return 2D boolean represents the capacity to expend (if some free space is available) * @return 2D boolean represents the capacity to expend (if some free space is available)
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3b canExpandIfFree() { public Vector2b canExpandIfFree() {
if (!this.propertyHide) { if (!this.propertyHide) {
return this.propertyExpandIfFree; return this.propertyExpandIfFree;
} }
return Vector3b.FALSE; return Vector2b.FALSE;
} }
/** /**
* get the filling capabilities xy * get the filling capabilities xy
* @return Vector3b repensent the capacity to xy filling * @return Vector2b repensent the capacity to xy filling
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3b canFill() { public Vector2b canFill() {
return this.propertyFill; return this.propertyFill;
} }
@ -177,8 +178,8 @@ public class Widget extends EwolObject {
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public void checkMaxSize() { public void checkMaxSize() {
final Vector3f pixelSize = this.propertyMaxSize.getPixel(); final Vector2f pixelSize = this.propertyMaxSize.getPixel();
this.maxSize = Vector3f.min(this.maxSize, pixelSize); this.maxSize = Vector2f.min(this.maxSize, pixelSize);
} }
/** /**
@ -187,8 +188,8 @@ public class Widget extends EwolObject {
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public void checkMinSize() { public void checkMinSize() {
final Vector3f pixelSize = this.propertyMinSize.getPixel(); final Vector2f pixelSize = this.propertyMinSize.getPixel();
this.minSize = Vector3f.max(this.minSize, pixelSize); this.minSize = Vector2f.max(this.minSize, pixelSize);
} }
public void drawWidgetTree(final int level) { public void drawWidgetTree(final int level) {
@ -206,11 +207,11 @@ public class Widget extends EwolObject {
* @return Requested size * @return Requested size
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3f getCalculateMaxSize() { public Vector2f getCalculateMaxSize() {
if (!this.propertyHide) { if (!this.propertyHide) {
return this.maxSize; return this.maxSize;
} }
return Vector3f.MAX_VALUE; return Vector2f.MAX_VALUE;
} }
/** /**
@ -218,11 +219,11 @@ public class Widget extends EwolObject {
* @return Requested size * @return Requested size
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3f getCalculateMinSize() { public Vector2f getCalculateMinSize() {
if (!this.propertyHide) { if (!this.propertyHide) {
return this.minSize; return this.minSize;
} }
return Vector3f.ZERO; return Vector2f.ZERO;
} }
/** /**
@ -262,7 +263,7 @@ public class Widget extends EwolObject {
* get the offset property of the widget. * get the offset property of the widget.
* @return The current offset value. * @return The current offset value.
*/ */
Vector3f getOffset() { Vector2f getOffset() {
return this.offset; return this.offset;
} }
@ -270,7 +271,7 @@ public class Widget extends EwolObject {
* Get the origin (absolute position in the windows). * Get the origin (absolute position in the windows).
* @return Coordinate of the origin requested. * @return Coordinate of the origin requested.
*/ */
public Vector3f getOrigin() { public Vector2f getOrigin() {
return this.origin; return this.origin;
} }
@ -286,7 +287,7 @@ public class Widget extends EwolObject {
@AknotAttribute @AknotAttribute
@AknotName("expand") @AknotName("expand")
@AknotDescription("Request the widget Expand size while space is available") @AknotDescription("Request the widget Expand size while space is available")
public Vector3b getPropertyExpand() { public Vector2b getPropertyExpand() {
return this.propertyExpand; return this.propertyExpand;
} }
@ -294,7 +295,7 @@ public class Widget extends EwolObject {
@AknotAttribute @AknotAttribute
@AknotName("expand-free") @AknotName("expand-free")
@AknotDescription("Request the widget Expand size while free space is detected (does not generate expand in upper wideget)") @AknotDescription("Request the widget Expand size while free space is detected (does not generate expand in upper wideget)")
public Vector3b getPropertyExpandIfFree() { public Vector2b getPropertyExpandIfFree() {
return this.propertyExpandIfFree; return this.propertyExpandIfFree;
} }
@ -302,7 +303,7 @@ public class Widget extends EwolObject {
@AknotAttribute @AknotAttribute
@AknotName("fill") @AknotName("fill")
@AknotDescription("Fill the widget available size") @AknotDescription("Fill the widget available size")
public Vector3b getPropertyFill() { public Vector2b getPropertyFill() {
return this.propertyFill; return this.propertyFill;
} }
@ -326,7 +327,7 @@ public class Widget extends EwolObject {
@AknotAttribute @AknotAttribute
@AknotName("max-size") @AknotName("max-size")
@AknotDescription("User maximum size") @AknotDescription("User maximum size")
public Dimension3f getPropertyMaxSize() { public Dimension2f getPropertyMaxSize() {
return this.propertyMaxSize; return this.propertyMaxSize;
} }
@ -334,7 +335,7 @@ public class Widget extends EwolObject {
@AknotAttribute @AknotAttribute
@AknotName("min-size") @AknotName("min-size")
@AknotDescription("User minimum size") @AknotDescription("User minimum size")
public Dimension3f getPropertyMinSize() { public Dimension2f getPropertyMinSize() {
return this.propertyMinSize; return this.propertyMinSize;
} }
@ -343,11 +344,11 @@ public class Widget extends EwolObject {
* @return Requested size * @return Requested size
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Vector3f getSize() { public Vector2f getSize() {
if (!this.propertyHide) { if (!this.propertyHide) {
return this.size; return this.size;
} }
return Vector3f.ZERO; return Vector2f.ZERO;
} }
/** /**
@ -357,7 +358,7 @@ public class Widget extends EwolObject {
* @return pointer on the widget found * @return pointer on the widget found
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (!this.propertyHide) { if (!this.propertyHide) {
return this; return this;
} }
@ -554,12 +555,12 @@ public class Widget extends EwolObject {
protected void onRegenerateDisplay() {} protected void onRegenerateDisplay() {}
protected void onUpdateMinMaxSize() { protected void onUpdateMinMaxSize() {
final Vector3f pixelMin = this.propertyMinSize.getPixel(); final Vector2f pixelMin = this.propertyMinSize.getPixel();
final Vector3f pixelMax = this.propertyMaxSize.getPixel(); final Vector2f pixelMax = this.propertyMaxSize.getPixel();
// check minimum maximum compatibility : // check minimum maximum compatibility :
if (pixelMin.x() > pixelMax.x() || pixelMin.y() > pixelMax.y()) { if (pixelMin.x() > pixelMax.x() || pixelMin.y() > pixelMax.y()) {
LOGGER.error("Can not set a 'min size' > 'max size' reset to maximum ..."); LOGGER.error("Can not set a 'min size' > 'max size' reset to maximum ...");
this.propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL); this.propertyMaxSize = new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL);
} }
requestUpdateSize(); requestUpdateSize();
} }
@ -569,7 +570,7 @@ public class Widget extends EwolObject {
* @param pos Absolute position that you request conversion. * @param pos Absolute position that you request conversion.
* @return The relative position. * @return The relative position.
*/ */
public Vector3f relativePosition(final Vector3f pos) { public Vector2f relativePosition(final Vector2f pos) {
return pos.less(this.origin); return pos.less(this.origin);
} }
@ -644,21 +645,21 @@ public class Widget extends EwolObject {
* User set No maximum size. * User set No maximum size.
*/ */
public void setNoMaxSize() { public void setNoMaxSize() {
setPropertyMaxSize(new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL)); setPropertyMaxSize(new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL));
} }
/** /**
* User set No minimum size. * User set No minimum size.
*/ */
public void setNoMinSize() { public void setNoMinSize() {
setPropertyMinSize(new Dimension3f(Vector3f.ZERO, Distance.PIXEL)); setPropertyMinSize(new Dimension2f(Vector2f.ZERO, Distance.PIXEL));
} }
/** /**
* set the zoom property of the widget. * set the zoom property of the widget.
* @param newVal offset value. * @param newVal offset value.
*/ */
public void setOffset(final Vector3f newVal) { public void setOffset(final Vector2f newVal) {
LOGGER.info("Set offset: " + newVal); LOGGER.info("Set offset: " + newVal);
if (this.offset != newVal) { if (this.offset != newVal) {
this.offset = newVal; this.offset = newVal;
@ -672,7 +673,7 @@ public class Widget extends EwolObject {
* @param pos Position of the origin. * @param pos Position of the origin.
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
public void setOrigin(final Vector3f pos) { public void setOrigin(final Vector2f pos) {
this.origin = pos; this.origin = pos;
} }
@ -689,7 +690,7 @@ public class Widget extends EwolObject {
} }
} }
public void setPropertyExpand(final Vector3b value) { public void setPropertyExpand(final Vector2b value) {
if (this.propertyExpand.equals(value)) { if (this.propertyExpand.equals(value)) {
return; return;
} }
@ -698,7 +699,7 @@ public class Widget extends EwolObject {
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyExpandIfFree(final Vector3b value) { public void setPropertyExpandIfFree(final Vector2b value) {
if (this.propertyExpandIfFree.equals(value)) { if (this.propertyExpandIfFree.equals(value)) {
return; return;
} }
@ -707,7 +708,7 @@ public class Widget extends EwolObject {
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyFill(final Vector3b value) { public void setPropertyFill(final Vector2b value) {
if (this.propertyFill.equals(value)) { if (this.propertyFill.equals(value)) {
return; return;
} }
@ -734,7 +735,7 @@ public class Widget extends EwolObject {
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyMaxSize(final Dimension3f value) { public void setPropertyMaxSize(final Dimension2f value) {
if (this.propertyMaxSize.equals(value)) { if (this.propertyMaxSize.equals(value)) {
return; return;
} }
@ -742,7 +743,7 @@ public class Widget extends EwolObject {
onUpdateMinMaxSize(); onUpdateMinMaxSize();
} }
public void setPropertyMinSize(final Dimension3f value) { public void setPropertyMinSize(final Dimension2f value) {
if (this.propertyMinSize.equals(value)) { if (this.propertyMinSize.equals(value)) {
return; return;
} }
@ -755,7 +756,7 @@ public class Widget extends EwolObject {
* @return Requested size * @return Requested size
* @note : INTERNAL EWOL SYSTEM Do not modify the size yourself: calculation is complex and need knowledge of around widget * @note : INTERNAL EWOL SYSTEM Do not modify the size yourself: calculation is complex and need knowledge of around widget
*/ */
public void setSize(final Vector3f value) { public void setSize(final Vector2f value) {
this.size = value; this.size = value;
if (this.size.x() > 15000) { if (this.size.x() > 15000) {
return; return;
@ -940,7 +941,7 @@ public class Widget extends EwolObject {
// widget is hidden ... // widget is hidden ...
return; return;
} }
final Vector3f displayOrigin = this.origin.add(this.offset); final Vector2f displayOrigin = this.origin.add(this.offset);
// check if the element is displayable in the windows : // check if the element is displayable in the windows :
if (displayProp.windowsSize().x() < this.origin.x() || displayProp.windowsSize().y() < this.origin.y()) { if (displayProp.windowsSize().x() < this.origin.x() || displayProp.windowsSize().y() < this.origin.y()) {
@ -958,12 +959,12 @@ public class Widget extends EwolObject {
Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()), Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()),
(int) (this.origin.y() - tmpSize.origin().y())); (int) (this.origin.y() - tmpSize.origin().y()));
downOffset = Vector2i.min(downOffset, Vector2i.ZERO); downOffset = Vector2i.min(downOffset, Vector2i.ZERO);
//LOGGER.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger()); //LOGGER.info("translate : (" + (new Vector2f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
// translate the display to have a Gui 0,0 position on the Left button angle // translate the display to have a Gui 0,0 position on the Left button angle
final Matrix4f tmpTranslate = Matrix4f final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), .createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(),
-tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger()); -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
//final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector3f(0, 0, 1.0f)); //final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector2f(0, 0, 1.0f));
// Scale if needed (feature not validate) // Scale if needed (feature not validate)
final Matrix4f tmpScale = Matrix4f.createMatrixScale(this.zoom, this.zoom, 1.0f); final Matrix4f tmpScale = Matrix4f.createMatrixScale(this.zoom, this.zoom, 1.0f);
// create orthogonal projection for GUI ==> simple to manage staking // create orthogonal projection for GUI ==> simple to manage staking
@ -1037,7 +1038,7 @@ public class Widget extends EwolObject {
/* /*
this.drawDebugBorder.setColor(Color.BLUE); this.drawDebugBorder.setColor(Color.BLUE);
this.drawDebugBorder.setPos(3, 3); this.drawDebugBorder.setPos(3, 3);
this.drawDebugBorder.rectangleWidth(new Vector3f(this.size.x() - 6, this.size.y() - 6, 0)); this.drawDebugBorder.rectangleWidth(new Vector2f(this.size.x() - 6, this.size.y() - 6, 0));
*/ */
this.drawDebugBorder.flush(); this.drawDebugBorder.flush();
} }

View File

@ -14,8 +14,8 @@ import java.util.Map.Entry;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.compositing.Compositing; import org.atriasoft.ewol.compositing.Compositing;
import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.compositing.CompositingText;
@ -29,7 +29,7 @@ class WidgetList extends WidgetScrolled {
// drawing capabilities .... // drawing capabilities ....
protected List<Compositing> listOObject = new ArrayList<>(); //!< generic element to display... protected List<Compositing> listOObject = new ArrayList<>(); //!< generic element to display...
protected List<Integer> listSizeX = new ArrayList<>(); //!< size of every colomns protected List<Integer> listSizeX = new ArrayList<>(); //!< size of every colons
protected List<Integer> listSizeY = new ArrayList<>(); //!< size of every rows protected List<Integer> listSizeY = new ArrayList<>(); //!< size of every rows
protected Map<String, Compositing> compositingElements = new HashMap<>(); protected Map<String, Compositing> compositingElements = new HashMap<>();
@ -37,7 +37,7 @@ class WidgetList extends WidgetScrolled {
protected int paddingSizeX = 0; protected int paddingSizeX = 0;
protected int paddingSizeY = 0; protected int paddingSizeY = 0;
protected int displayStartRaw = 0; //!< Current starting diaplayed raw protected int displayStartRaw = 0; //!< Current starting displayed raw
protected int displayCurrentNbLine = 0; //!< Number of line in the display protected int displayCurrentNbLine = 0; //!< Number of line in the display
@ -68,7 +68,7 @@ class WidgetList extends WidgetScrolled {
protected Vector2f calculateElementSize(final Vector2i pos) { protected Vector2f calculateElementSize(final Vector2i pos) {
if (getComposeElemnent("text") instanceof final CompositingText tmpText) { if (getComposeElemnent("text") instanceof final CompositingText tmpText) {
if (getData(ListRole.Text, pos) instanceof final String myTextToWrite) { if (getData(ListRole.Text, pos) instanceof final String myTextToWrite) {
final Vector3f textSize = tmpText.calculateSize(myTextToWrite); final Vector2f textSize = tmpText.calculateSize(myTextToWrite);
//final Vector2i count = getMatrixSize(); //final Vector2i count = getMatrixSize();
return new Vector2f(textSize.x(), textSize.y() + this.paddingSizeY * 3); return new Vector2f(textSize.x(), textSize.y() + this.paddingSizeY * 3);
} }
@ -84,7 +84,7 @@ class WidgetList extends WidgetScrolled {
this.minSize.x = 3+minWidth; this.minSize.x = 3+minWidth;
this.minSize.y = 3+minHeight; this.minSize.y = 3+minHeight;
*/ */
this.minSize = new Vector3f(200, 150, 10); this.minSize = new Vector2f(200, 150);
} }
protected void clearComposeElemnent() { protected void clearComposeElemnent() {
@ -105,7 +105,7 @@ class WidgetList extends WidgetScrolled {
if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) { if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) {
final Color basicBG = getBasicBG(); final Color basicBG = getBasicBG();
BGOObjects.setColor(basicBG); BGOObjects.setColor(basicBG);
BGOObjects.setPos(Vector3f.ZERO); BGOObjects.setPos(Vector2f.ZERO);
BGOObjects.rectangleWidth(new Vector2f(this.size.x(), this.size.y())); BGOObjects.rectangleWidth(new Vector2f(this.size.x(), this.size.y()));
} }
} }
@ -122,7 +122,7 @@ class WidgetList extends WidgetScrolled {
if (getData(ListRole.BgColor, pos) instanceof final Color bg) { if (getData(ListRole.BgColor, pos) instanceof final Color bg) {
if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) { if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) {
BGOObjects.setColor(bg); BGOObjects.setColor(bg);
BGOObjects.setPos(new Vector3f(start.x(), start.y(), 0)); BGOObjects.setPos(new Vector2f(start.x(), start.y()));
BGOObjects.rectangleWidth(size); BGOObjects.rectangleWidth(size);
} }
} }
@ -131,7 +131,7 @@ class WidgetList extends WidgetScrolled {
if (getComposeElemnent("text") instanceof final CompositingText tmpText) { if (getComposeElemnent("text") instanceof final CompositingText tmpText) {
final int displayPositionY = (int) (start.y() + this.paddingSizeY); final int displayPositionY = (int) (start.y() + this.paddingSizeY);
tmpText.setColor(fg); tmpText.setColor(fg);
tmpText.setPos(new Vector3f(start.x() + this.paddingSizeX, displayPositionY, 0)); tmpText.setPos(new Vector2f(start.x() + this.paddingSizeX, displayPositionY));
tmpText.print(myTextToWrite); tmpText.print(myTextToWrite);
} }
} }
@ -198,7 +198,7 @@ class WidgetList extends WidgetScrolled {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
Vector3f relativePos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); Vector2f relativePos = relativePosition(new Vector2f(event.pos().x(), event.pos().y()));
if (super.onEventInput(event)) { if (super.onEventInput(event)) {
keepFocus(); keepFocus();
// nothing to do ... done on upper widget ... // nothing to do ... done on upper widget ...
@ -207,10 +207,10 @@ class WidgetList extends WidgetScrolled {
if (this.listSizeY.size() == 0) { if (this.listSizeY.size() == 0) {
return false; return false;
} }
relativePos = new Vector3f(relativePos.x() + this.originScrooled.x(), relativePos = new Vector2f(relativePos.x() + this.originScrooled.x(),
this.size.y() - relativePos.y() + this.originScrooled.y(), 0); this.size.y() - relativePos.y() + this.originScrooled.y());
// Find the colomn and the row // Find the colomn and the row
Vector3i pos = Vector3i.ZERO; Vector2i pos = Vector2i.ZERO;
float offsetY = 0; float offsetY = 0;
for (int iii = 0; iii < this.listSizeY.size() - 1; iii++) { for (int iii = 0; iii < this.listSizeY.size() - 1; iii++) {
final int previous = (int) offsetY; final int previous = (int) offsetY;
@ -239,7 +239,7 @@ class WidgetList extends WidgetScrolled {
break; break;
} }
} }
final Vector3f posInternalMouse = relativePos.less(offsetX, offsetY, 0); final Vector2f posInternalMouse = relativePos.less(offsetX, offsetY);
final boolean isUsed = onItemEvent(event, pos, posInternalMouse); final boolean isUsed = onItemEvent(event, pos, posInternalMouse);
if (isUsed) { if (isUsed) {
// TODO : this generate bugs ... I did not understand why .. // TODO : this generate bugs ... I did not understand why ..
@ -258,7 +258,7 @@ class WidgetList extends WidgetScrolled {
LOGGER.debug("WidgetList get focus"); LOGGER.debug("WidgetList get focus");
} }
protected boolean onItemEvent(final EventInput event, final Vector3i pos, final Vector3f mousePosition) { protected boolean onItemEvent(final EventInput event, final Vector2i pos, final Vector2f mousePosition) {
return false; return false;
} }

View File

@ -9,7 +9,7 @@ import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.HighSpeedMode; import org.atriasoft.ewol.HighSpeedMode;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
@ -116,7 +116,7 @@ class WidgetScrolled extends Widget {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
LOGGER.trace("event XXX {}", event); LOGGER.trace("event XXX {}", event);
Vector3f relativePos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0.0f)); Vector2f relativePos = relativePosition(new Vector2f(event.pos().x(), event.pos().y()));
// Correction due to the open Gl insertion ... // Correction due to the open Gl insertion ...
relativePos = relativePos.withY(this.size.y() - relativePos.y()); relativePos = relativePos.withY(this.size.y() - relativePos.y());
final Padding paddingV = new Padding(2, 2, 2, 2);// this.shaperV.getPadding(); final Padding paddingV = new Padding(2, 2, 2, 2);// this.shaperV.getPadding();
@ -618,9 +618,9 @@ class WidgetScrolled extends Widget {
OpenGL.setViewPort(this.origin, this.size); OpenGL.setViewPort(this.origin, this.size);
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2, final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2,
-this.size.y() / 2, this.size.y() / 2, -1, 1); -this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpScale = Matrix4f.createMatrixScale(new Vector3f(this.zoom, this.zoom, 1)); final Matrix4f tmpScale = Matrix4f.createMatrixScale(new Vector2f(this.zoom, this.zoom));
final Matrix4f tmpTranslate = Matrix4f final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1)); .createMatrixTranslate(new Vector2f(-this.maxSize.x() / 2, -this.maxSize.y() / 2));
final Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate); final Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate);
// set internal matrix system : // set internal matrix system :
OpenGL.setMatrix(tmpMat); OpenGL.setMatrix(tmpMat);
@ -633,7 +633,7 @@ class WidgetScrolled extends Widget {
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2, final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2,
-this.size.y() / 2, this.size.y() / 2, -1, 1); -this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpTranslate = Matrix4f final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1)); .createMatrixTranslate(new Vector2f(-this.maxSize.x() / 2, -this.maxSize.y() / 2));
final Matrix4f tmpMat = tmpProjection.multiply(tmpTranslate); final Matrix4f tmpMat = tmpProjection.multiply(tmpTranslate);
// set internal matrix system : // set internal matrix system :
OpenGL.setMatrix(tmpMat); OpenGL.setMatrix(tmpMat);

View File

@ -16,8 +16,8 @@ import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.context.EwolContext; import org.atriasoft.ewol.context.EwolContext;
@ -111,10 +111,10 @@ public class Windows extends Widget {
} }
@Override @Override
public Widget getWidgetAtPos(final Vector3f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
LOGGER.trace("Get widget at pos : " + pos); LOGGER.trace("Get widget at pos : " + pos);
// calculate relative position // calculate relative position
final Vector3f relativePos = relativePosition(pos); final Vector2f relativePos = relativePosition(pos);
// event go directly on the pop-up // event go directly on the pop-up
if (this.popUpWidgetList.size() != 0) { if (this.popUpWidgetList.size() != 0) {
return this.popUpWidgetList.get(this.popUpWidgetList.size() - 1).getWidgetAtPos(pos); return this.popUpWidgetList.get(this.popUpWidgetList.size() - 1).getWidgetAtPos(pos);
@ -144,14 +144,14 @@ public class Windows extends Widget {
this.subWidget.calculateMinMaxSize(); this.subWidget.calculateMinMaxSize();
// TODO : do it better ... and manage gravity ... // TODO : do it better ... and manage gravity ...
this.subWidget.setSize(this.size); this.subWidget.setSize(this.size);
this.subWidget.setOrigin(Vector3f.ZERO); this.subWidget.setOrigin(Vector2f.ZERO);
this.subWidget.onChangeSize(); this.subWidget.onChangeSize();
} }
for (final Widget it : this.popUpWidgetList) { for (final Widget it : this.popUpWidgetList) {
if (it != null) { if (it != null) {
it.calculateMinMaxSize(); it.calculateMinMaxSize();
it.setSize(this.size); it.setSize(this.size);
it.setOrigin(Vector3f.ZERO); it.setOrigin(Vector2f.ZERO);
it.onChangeSize(); it.onChangeSize();
} }
} }
@ -277,7 +277,7 @@ public class Windows extends Widget {
public void sysDraw() { public void sysDraw() {
//LOGGER.trace("Draw on " + this.size); //LOGGER.trace("Draw on " + this.size);
// set the size of the open GL system // set the size of the open GL system
OpenGL.setViewPort(Vector3f.ZERO, this.size); OpenGL.setViewPort(Vector2f.ZERO, this.size);
OpenGL.disable(OpenGL.Flag.flag_dither); OpenGL.disable(OpenGL.Flag.flag_dither);
//OpenGL.disable(OpenGL.Flag.flagblend); //OpenGL.disable(OpenGL.Flag.flagblend);
OpenGL.disable(OpenGL.Flag.flag_stencilTest); OpenGL.disable(OpenGL.Flag.flag_stencilTest);
@ -293,8 +293,8 @@ public class Windows extends Widget {
// clear the matrix system : // clear the matrix system :
OpenGL.setBasicMatrix(Matrix4f.IDENTITY); OpenGL.setBasicMatrix(Matrix4f.IDENTITY);
final Vector3i tmpSize = new Vector3i((int) this.size.x(), (int) this.size.y(), (int) this.size.z()); final Vector2i tmpSize = new Vector2i((int) this.size.x(), (int) this.size.y());
final DrawProperty displayProp = new DrawProperty(tmpSize, Vector3i.ZERO, tmpSize); final DrawProperty displayProp = new DrawProperty(tmpSize, Vector2i.ZERO, tmpSize);
systemDraw(displayProp); systemDraw(displayProp);
OpenGL.disable(OpenGL.Flag.flag_blend); OpenGL.disable(OpenGL.Flag.flag_blend);
} }

View File

@ -5,7 +5,7 @@ import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.resource.ResourceConfigFile; import org.atriasoft.ewol.resource.ResourceConfigFile;
import org.atriasoft.ewol.widget.Button; import org.atriasoft.ewol.widget.Button;
@ -116,8 +116,8 @@ public class SpinBase extends Sizer {
this.widgetEntry.setPropertyConfig(Uri.valueOf(shaper)); this.widgetEntry.setPropertyConfig(Uri.valueOf(shaper));
} }
} }
this.widgetEntry.setPropertyExpand(new Vector3b(true, false, false)); this.widgetEntry.setPropertyExpand(Vector2b.TRUE_FALSE);
this.widgetEntry.setPropertyFill(Vector3b.TRUE); this.widgetEntry.setPropertyFill(Vector2b.TRUE);
} }
if (this.widgetButtonDown == null) { if (this.widgetButtonDown == null) {
this.widgetButtonDown = new Button(); this.widgetButtonDown = new Button();
@ -128,8 +128,8 @@ public class SpinBase extends Sizer {
this.widgetButtonDown.setPropertyConfig(Uri.valueOf(shaper)); this.widgetButtonDown.setPropertyConfig(Uri.valueOf(shaper));
} }
} }
this.widgetButtonDown.setPropertyExpand(new Vector3b(false, false, false)); this.widgetButtonDown.setPropertyExpand(Vector2b.FALSE);
this.widgetButtonDown.setPropertyFill(Vector3b.TRUE); this.widgetButtonDown.setPropertyFill(Vector2b.TRUE);
final String data = this.config.getString(this.confIdDownData); final String data = this.config.getString(this.confIdDownData);
final Widget widget = Composer.composerGenerateString(data); final Widget widget = Composer.composerGenerateString(data);
//this.widgetButtonDown.setSubWidget(widget, 0); //this.widgetButtonDown.setSubWidget(widget, 0);
@ -144,8 +144,8 @@ public class SpinBase extends Sizer {
this.widgetButtonUp.setPropertyConfig(Uri.valueOf(shaper)); this.widgetButtonUp.setPropertyConfig(Uri.valueOf(shaper));
} }
} }
this.widgetButtonUp.setPropertyExpand(new Vector3b(false, false, false)); this.widgetButtonUp.setPropertyExpand(Vector2b.FALSE);
this.widgetButtonUp.setPropertyFill(Vector3b.TRUE); this.widgetButtonUp.setPropertyFill(Vector2b.TRUE);
final String data = this.config.getString(this.confIdUpData); final String data = this.config.getString(this.confIdUpData);
final Widget widget = Composer.composerGenerateString(data); final Widget widget = Composer.composerGenerateString(data);
this.widgetButtonUp.setSubWidget(widget); this.widgetButtonUp.setSubWidget(widget);

View File

@ -0,0 +1,397 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
package org.atriasoft.ewol.compositing;
import org.atriasoft.egami.ImageByte;
import org.atriasoft.egami.ImageByteRGBA;
import org.atriasoft.egami.ToolImage;
import org.atriasoft.esvg.EsvgDocument;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
import org.atriasoft.gale.resource.ResourceProgram;
import org.atriasoft.gale.resource.ResourceTexture2;
import org.atriasoft.gale.resource.ResourceTextureFile;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingSVG extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingSVG.class);
public static final int NB_VBO = 3;
public static final int SIZE_AUTO = 0;
public static final int VBO_ID_COLOR = 2;
// VBO table property:
public static final int VBO_ID_COORD = 0;
public static final int VBO_ID_COORD_TEX = 1;
private float angle = 0; //!< Angle to set at the axes
private Color color = new Color(1, 1, 1); //!< The text foreground color
private String svgData;
protected int oGLMatrixProjection = -1; //!< openGL id on the element (Projection matrix)
protected int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix)
protected int oGLMatrixView = -1; //!< openGL id on the element (view matrix)
private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program
private Vector2f position = Vector2f.ZERO; //!< The current position to draw
private Vector2i requestSize = new Vector2i(2, 2);
private ResourceTexture2 resourceImage = null; //!< texture resources
private ResourceVirtualArrayObject vbo = null;
private Color[] vboDataColors = null;
private Vector2f[] vboDataCoords = null;
private Vector2f[] vboDataCoordsTex = null;
public CompositingSVG() {
this("<svg></svg>", CompositingSVG.SIZE_AUTO);
}
public CompositingSVG(final String data, final int size) {
this.svgData = data;
// Create the VBO:
this.vbo = ResourceVirtualArrayObject.createDynamic();
if (this.vbo == null) {
LOGGER.error("can not instanciate VBO ...");
return;
}
// TO facilitate some debugs we add a name of the VBO:
this.vbo.setName("[VBO] of " + this.getClass().getCanonicalName());
setSource(data, size);
loadProgram();
}
/**
* clear alll tre registered element in the current element
*/
@Override
public void clear() {
// call upper class
super.clear();
// reset Buffer :
this.vbo.clear();
// reset temporal variables :
this.position = Vector2f.ZERO;
this.color = Color.WHITE;
this.angle = 0;
}
/**
* draw All the registered text in the current element on openGL
* @param disableDepthTest disable the Depth test for display
*/
@Override
public void draw(final boolean disableDepthTest) {
/*
if (this.VBO.bufferSize(this.vboIdCoord) <= 0) {
//LOGGER.warn("Nothink to draw...");
return;
}
*/
if (this.resourceImage == null) {
return;
}
if (this.oGLprogram == null) {
LOGGER.error("No shader ...");
return;
}
//LOGGER.warn("Display image : " + this.VBO.bufferSize(this.vboIdCoord));
if (disableDepthTest) {
OpenGL.disable(OpenGL.Flag.flag_depthTest);
} else {
OpenGL.enable(OpenGL.Flag.flag_depthTest);
}
// set Matrix : translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix();
final Matrix4f camMatrix = OpenGL.getCameraMatrix();
this.oGLprogram.use();
this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, this.matrixApply);
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
// TextureID
this.resourceImage.bindForRendering(0);
this.vbo.renderArrays(RenderMode.TRIANGLE);
this.vbo.unBindForRendering();
this.oGLprogram.unUse();
}
@Override
public void flush() {
this.vbo.setPosition(this.vboDataCoords);
this.vbo.setTextureCoordinate(this.vboDataCoordsTex);
this.vbo.setColors(this.vboDataColors);
this.vbo.setVertexCount(this.vboDataCoords.length);
this.vbo.flush();
}
/**
* get the current display position (sometime needed in the gui control)
* @return the current position.
*/
public Vector2f getPos() {
return this.position;
}
/**
* get the source image registered size in the file (<0 when multiple size image)
* @return tre image registered size
*/
public Vector2i getRealSize() {
if (this.resourceImage == null) {
return Vector2i.ZERO;
}
return this.resourceImage.getUsableSize();
}
/**
* Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources.
*/
public boolean hasSources() {
return this.resource != null;
}
/**
* load the openGL program and get all the ID needed
*/
private void loadProgram() {
// get the shader resource:
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"),
new Uri("DATA", "textured3D.frag", "ewol"));
if (this.oGLprogram != null) {
this.oGLMatrixTransformation = this.oGLprogram.getUniform("in_matrixTransformation");
this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection");
this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView");
}
}
public void print(final Vector2f size) {
printPart(size, Vector2f.ZERO, Vector2f.ONE);
}
/**
* add a compleate of the image to display with the requested size
* @param size size of the output image
*/
public void print(final Vector2i size) {
print(new Vector2f(size.x(), size.y()));
}
/**
* add a part of the image to display with the requested size
* @param size size of the output image
* @param sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
* @param sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
*/
public void printPart(final Vector2f size, final Vector2f sourcePosStartIn, final Vector2f sourcePosStopIn) {
if (this.resource == null) {
return;
}
final Vector2f openGLSize = new Vector2f(this.resource.getOpenGlSize().x(), this.resource.getOpenGlSize().y());
final Vector2i usefullSize = this.resource.getUsableSize();
final Vector2f ratio = new Vector2f(usefullSize.x() / openGLSize.x(), usefullSize.y() / openGLSize.y());
final Vector2f sourcePosStart = sourcePosStartIn.multiply(ratio);
final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio);
LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart
+ " stop=" + sourcePosStop);
this.vboDataColors = new Color[6];
this.vboDataCoords = new Vector2f[6];
this.vboDataCoordsTex = new Vector2f[6];
if (this.angle == 0.0f) {
Vector2f point = this.position;
int indexElem = 0;
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector2f(this.position.x() + size.x(), this.position.y(), 0);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector2f(this.position.x() + size.x(), this.position.y() + size.y(), 0);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector2f(this.position.x(), this.position.y() + size.y(), 0);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector2f(this.position.x(), this.position.y(), 0);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
return;
}
final Vector2f center = this.position.add(new Vector2f(size.x(), size.y(), 0)).divide(2.0f);
final Vector2f limitedSize = new Vector2f(size.x() * 0.5f, size.y() * 0.5f, 0.0f);
Vector2f point = Vector2f.ZERO;
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
int indexElem = 0;
point = new Vector2f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector2f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector2f(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector2f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector2f(limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector2f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector2f(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector2f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector2f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector2f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color;
}
/**
* set a unique rotation of this element (not set in the rotate Generic system)
* @param angleRad Angle to set in radiant.
*/
public void setAngle(final float angleRad) {
this.angle = angleRad;
}
/**
* set the Color of the current foreground font
* @param color Color to set on foreground (for next print)
*/
public void setColor(final Color color) {
this.color = color;
}
public void setPos(final Vector2f pos) {
setPos(new Vector2f(pos.x(), pos.y(), 0));
}
/**
* set position for the next text writen
* @param pos Position of the text (in 3D)
*/
public void setPos(final Vector2f pos) {
this.position = pos;
}
public void setRelPos(final Vector2f pos) {
setRelPos(new Vector2f(pos.x(), pos.y(), 0));
}
/**
* set relative position for the next text writen
* @param pos ofset apply of the text (in 3D)
*/
public void setRelPos(final Vector2f pos) {
this.position = this.position.add(pos);
}
public void setSource(final ImageByteRGBA image) {
clear();
this.svgData = null;
this.requestSize = image.getSize();
this.resourceImage = new ResourceTexture2();
this.resourceImage.set(image);
}
public void setSource(final String data) {
setSource(data, 32);
}
public void setSource(final String data, final int size) {
setSource(data, new Vector2i(size, size));
}
public void setSource(final String data, final Vector2i size) {
clear();
final EsvgDocument doc = new EsvgDocument();
doc.parse(data);
final ImageByte tmp = ToolImage.convertImageByte(doc.renderImageFloatRGBA(size));
if (tmp == null) {
LOGGER.error("Can not load the Raw SVG ... ");
return;
}
this.resourceImage.set(tmp);
if (this.svgData.equals(data) && this.requestSize.x() == size.x() && this.requestSize.y() == size.y()) {
// Nothing to do ...
return;
}
final ResourceTextureFile resource = this.resource;
final ResourceTexture2 resourceTex = this.resourceImage;
this.svgData = data;
this.requestSize = size;
this.resource = null;
this.resourceImage = null;
final Vector2i tmpSize = new Vector2i(size.x(), size.y());
// link to new one
this.resource = ResourceTexture2.create();
if (this.resource == null) {
LOGGER.error("Can not get Image resource");
}
}
}