diff --git a/samples/pom.xml b/samples/pom.xml index 0301d78..3346d16 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -50,6 +50,12 @@ logback-classic 1.5.18 + + ch.qos.logback + logback-classic + 1.5.18 + test + xerces xercesImpl diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java index b52dd90..d7805fb 100644 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java @@ -3,31 +3,34 @@ package sample.atriasoft.ewol.simpleWindowsWithBox; import org.atriasoft.etk.Color; import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector3b; +import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.widget.Box; +import org.atriasoft.ewol.widget.Box2; import sample.atriasoft.ewol.BasicWindows; public class MainWindows extends BasicWindows { - - Box testWidget; - + + Box2 testWidget; + public MainWindows() { //! [ewol_sample_HW_windows_title] setPropertyTitle("Simple CheckBox"); - + final Box innerWidget = new Box(); //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); innerWidget.setPropertyExpand(Vector3b.FALSE); innerWidget.setPropertyExpandIfFree(Vector3b.TRUE); innerWidget.setPropertyFill(Vector3b.TRUE); innerWidget.setPropertyColor(Color.PINK); - - this.testWidget = new Box(innerWidget); - //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); - this.testWidget.setPropertyExpand(Vector3b.TRUE); - this.testWidget.setPropertyFill(Vector3b.TRUE); + innerWidget.setPropertyMinSize(new Dimension3f(new Vector3f(50, 80, 15))); + + this.testWidget = new Box2(innerWidget); + this.testWidget.setPropertyExpand(Vector3b.FALSE); + this.testWidget.setPropertyFill(Vector3b.FALSE); this.testWidget.setPropertyBorderWidth(new Dimension1f(10)); this.testWidget.setPropertyBorderRadius(new Dimension1f(25)); this.testWidget.setPropertyBorderColor(Color.BLACK); diff --git a/samples/src/resources/logback.xml b/samples/src/resources/logback.xml index af419ee..83ccb8b 100644 --- a/samples/src/resources/logback.xml +++ b/samples/src/resources/logback.xml @@ -15,7 +15,7 @@ - + diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java index 413b2a0..f54b319 100644 --- a/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java +++ b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java @@ -333,7 +333,7 @@ public class CompositingSVG extends Compositing { } /** - * set position for the next text writen + * set position for the next text written * @param pos Position of the text (in 3D) */ public void setPos(final Vector3f pos) { @@ -345,8 +345,8 @@ public class CompositingSVG extends Compositing { } /** - * set relative position for the next text writen - * @param pos ofset apply of the text (in 3D) + * set relative position for the next text written + * @param pos offset apply of the text (in 3D) */ public void setRelPos(final Vector3f pos) { this.position = this.position.add(pos); @@ -374,6 +374,10 @@ public class CompositingSVG extends Compositing { // } public void setSource(final String data, final Vector2i size) { + if (data == null) { + LOGGER.error("try to set NULL data in svg"); + return; + } if (this.svgDoc == null && this.svgData.equals(data) && this.requestSize.x() == size.x() && this.requestSize.y() == size.y()) { // Nothing to do ... @@ -383,6 +387,7 @@ public class CompositingSVG extends Compositing { this.svgDoc = null; final EsvgDocument doc = new EsvgDocument(); doc.parse(data); + LOGGER.error("render size = {}", size); final ImageByte tmp = ToolImage.convertImageByte(doc.renderImageFloatRGBA(size)); if (tmp == null) { LOGGER.error("Can not load the Raw SVG ... "); diff --git a/src/main/org/atriasoft/ewol/widget/Box.java b/src/main/org/atriasoft/ewol/widget/Box.java index af7a791..b6bc04d 100644 --- a/src/main/org/atriasoft/ewol/widget/Box.java +++ b/src/main/org/atriasoft/ewol/widget/Box.java @@ -1,41 +1,24 @@ package org.atriasoft.ewol.widget; -import java.io.IOException; - 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.aknot.exception.AknotException; -import org.atriasoft.ejson.JsonMapper; -import org.atriasoft.ejson.exception.EjsonException; import org.atriasoft.etk.Color; import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; -import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2i; -import org.atriasoft.etk.math.Vector3b; 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; -/** - * @ingroup ewolWidgetGroup - * Entry box display : - * - * ~~~~~~~~~~~~~~~~~~~~~~ - * ------------- - * | Content | - * ------------- - * ~~~~~~~~~~~~~~~~~~~~~~ - */ public class Box extends Container { private static final Logger LOGGER = LoggerFactory.getLogger(Box.class); protected CompositingSVG compositing = new CompositingSVG(); - + public static class BoxParameter { public Float margin; public Float padding; @@ -44,7 +27,7 @@ public class Box extends Container { public String borderColor; public String color; } - + /** * Periodic call to update grapgic display * @param event Time generic event @@ -53,47 +36,31 @@ public class Box extends Container { LOGGER.trace("Periodic call on Entry(" + event + ")"); self.markToRedraw(); } - - private final Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol"); 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 Box() { - updateBasicConfig(); - } - + public Box() {} + /** * Constructor with his subWidget */ public Box(final Widget subWidget) { super(subWidget); - updateBasicConfig(); } - - private void updateBasicConfig() { - - final JsonMapper mapper = new JsonMapper(); - try { - final BoxParameter parameters = mapper.read(BoxParameter.class, this.propertyConfig); - // TODO ... - } catch (EjsonException | AknotException | IOException e) { - e.printStackTrace(); - } - } - - protected Dimension1f propertyBorderWidth = Dimension1f.ZERO; + protected Dimension1f propertyBorderWidth = Dimension1f.ZERO; + @AknotManaged @AknotAttribute @AknotName(value = "border-width") @@ -101,7 +68,7 @@ public class Box extends Container { public Dimension1f getPropertyBorderWidth() { return this.propertyBorderWidth; } - + public void setPropertyBorderWidth(final Dimension1f propertyBorder) { if (this.propertyBorderWidth.equals(propertyBorder)) { return; @@ -110,9 +77,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - + protected Dimension1f propertyBorderRadius = new Dimension1f(0); - + @AknotManaged @AknotAttribute @AknotName(value = "border-radius") @@ -120,7 +87,7 @@ public class Box extends Container { public Dimension1f getPropertyBorderRadius() { return this.propertyBorderRadius; } - + public void setPropertyBorderRadius(final Dimension1f propertyBorderRadius) { if (this.propertyBorderRadius.equals(propertyBorderRadius)) { return; @@ -129,9 +96,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - - protected Color propertyBorderColor = Color.NONE; + protected Color propertyBorderColor = Color.NONE; + @AknotManaged @AknotAttribute @AknotName(value = "border-color") @@ -139,7 +106,7 @@ public class Box extends Container { public Color getPropertyBorderColor() { return this.propertyBorderColor; } - + public void setPropertyBorderColor(final Color propertyBorderColor) { if (this.propertyBorderColor.equals(propertyBorderColor)) { return; @@ -148,9 +115,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - + protected Color propertyColor = Color.NONE; - + @AknotManaged @AknotAttribute @AknotName(value = "color") @@ -158,7 +125,7 @@ public class Box extends Container { public Color getPropertyColor() { return this.propertyColor; } - + public void setPropertyColor(final Color propertyColor) { if (this.propertyColor.equals(propertyColor)) { return; @@ -167,9 +134,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - - protected Dimension2f propertyMargin = Dimension2f.ZERO; + protected Dimension2f propertyMargin = Dimension2f.ZERO; + @AknotManaged @AknotAttribute @AknotName(value = "margin") @@ -177,7 +144,7 @@ public class Box extends Container { public Dimension2f getPropertyMargin() { return this.propertyMargin; } - + public void setPropertyMargin(final Dimension2f propertyMargin) { if (this.propertyMargin.equals(propertyMargin)) { return; @@ -186,9 +153,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - - protected Dimension2f propertyPadding = Dimension2f.ZERO; + protected Dimension2f propertyPadding = Dimension2f.ZERO; + @AknotManaged @AknotAttribute @AknotName(value = "padding") @@ -196,7 +163,7 @@ public class Box extends Container { public Dimension2f getPropertyPadding() { return this.propertyPadding; } - + public void setPropertyPadding(final Dimension2f propertyPadding) { if (this.propertyPadding.equals(propertyPadding)) { return; @@ -206,6 +173,23 @@ public class Box extends Container { 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(); @@ -231,29 +215,37 @@ public class Box extends Container { } else { subWidgetSize = subWidgetSize.withY(this.minSize.y()); } - if (this.subWidget.canExpand().z() && this.propertyFill.z()) { - subWidgetSize = subWidgetSize.withZ(this.size.z()); - } else { - subWidgetSize = subWidgetSize.withZ(this.minSize.z()); - } - subWidgetSize = subWidgetSize.less(offsetSubWidget.x(), offsetSubWidget.y(), 0); + subWidgetSize = subWidgetSize.less(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0); subWidgetSize = subWidgetSize.clipInteger(); - - // set config to the Sub-widget - //Vector3f subWidgetOrigin = this.origin.add(this.size.less(subWidgetSize).multiply(0.5f)); - Vector3f subWidgetOrigin = this.origin - .add(this.propertyGravity.gravityGenerateDelta(this.size.less(subWidgetSize))).add(50); - // NOTE le add 150 est pour un pb de test ==> a nlever en prod ... + + 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(); @@ -261,39 +253,26 @@ public class Box extends Container { //return; } final Vector2f localMargin = this.propertyMargin.size(); - - final Vector3f minSizeWithoutMargin = this.minSize.less(localMargin.x() * 2, localMargin.y() * 2, 0); - Vector3f tmpRenderSize = minSizeWithoutMargin; - Vector3f tmpRenderOrigin = this.propertyGravity.gravityGenerateDelta(this.size.less(minSizeWithoutMargin)); - if (this.propertyFill.x()) { - tmpRenderSize = tmpRenderSize.withX(this.size.x()); - tmpRenderOrigin = tmpRenderOrigin.withX(0.0f); - } - if (this.propertyFill.y()) { - tmpRenderSize = tmpRenderSize.withY(this.size.y()); - tmpRenderOrigin = tmpRenderOrigin.withY(0.0f); - } - if (this.propertyFill.z()) { - tmpRenderSize = tmpRenderSize.withZ(this.size.y()); - tmpRenderOrigin = tmpRenderOrigin.withZ(0.0f); - } + + 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); - - // this.renderSize = new Vector2i((int) (this.size.x() - this.propertyMargin.size().x() * 2), - // (int) (this.size.y() - this.propertyMargin.size().y() * 2)); - // Bug intéressant: la parsing de la couleur est foireux, black et #000000FF ne rend pas la même chose ==> pour ètre plus précs le rendu avec alpha est foireux... if (borderSize > 0.0f) { this.compositing.setSource(""" - + """.formatted( // + this.renderSize.x(), this.renderSize.y(), // paddingCompensateBorder, paddingCompensateBorder, // this.renderSize.x() - 2 * paddingCompensateBorder, this.renderSize.y() - 2 * paddingCompensateBorder, // @@ -318,7 +298,7 @@ public class Box extends Container { this.renderSize); } else { this.compositing.setSource(""" - + """.formatted( // + this.renderSize.x(), this.renderSize.y(), // paddingCompensateBorder, paddingCompensateBorder, // this.renderSize.x() - 2 * paddingCompensateBorder, this.renderSize.y() - 2 * paddingCompensateBorder, // @@ -339,56 +320,8 @@ public class Box extends Container { this.startPosition = this.renderOrigin; this.endPosition = this.renderOrigin.add(this.renderSize); this.compositing.print(this.renderSize); - // LOGGER.debug("propertyBorderColor=" + this.propertyBorderColor.toStringSharp()); - // LOGGER.debug("Paint Image at : " + this.origin + " size=" + this.size); - // LOGGER.debug("minSize: " + this.minSize + " size=" + this.size); this.compositing.flush(); } - - public void onChangeSize_____sdfgsdfqsdfqsdfqsdfsqdfqsdfqsdfsqdfsqdfqsdfqdfsqdfqsdfqsdfqsdfqsdfsqfgsdfg() { - super.onChangeSize(); - if (this.propertyHide) { - return; - } - if (this.subWidget == null) { - return; - } - Vector3f origin = this.origin.add(this.offset); - final Vector3f minSize = this.subWidget.getCalculateMinSize(); - final Vector3b expand = this.subWidget.getPropertyExpand(); - origin = origin.add(this.propertyGravity.gravityGenerateDelta(minSize.less(this.size))); - - 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); - this.subWidget.setOrigin(origin.add(offsetSubWidget.x(), offsetSubWidget.y(), 0.0f)); - this.subWidget.setSize(this.size.less(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0.0f)); - this.subWidget.onChangeSize(); - } - - @Override - public void calculateMinMaxSize() { - super.calculateMinMaxSize(); - final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y()); - //final Vector2f parentMaxSize = new Vector2f(this.maxSize.x(), this.maxSize.y()); - - LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth + " min-size=" + this.propertyMinSize); - final Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f, - this.propertyBorderWidth.size() * 2.0f); - final Vector2f padding = this.propertyPadding.size().multiply(2) - .max(new Vector2f(this.propertyBorderRadius.size() * 2 + this.propertyBorderWidth.size(), - this.propertyBorderRadius.size() * 2 + this.propertyBorderWidth.size())); - final Vector2f margin = this.propertyMargin.size().multiply(2); - final Vector3f minSize = this.propertyMinSize.size(); - final Vector2f borderMinSize = childMinSize.add(margin).add(padding).add(borderSize); - - final Vector2f calculatedBoxMinSize = Vector2f.max(borderMinSize, new Vector2f(minSize.x(), minSize.y())); - // LOGGER.debug("set widget min=" + this.minSize + " max=" + this.maxSize); - this.minSize = new Vector3f(calculatedBoxMinSize.x(), calculatedBoxMinSize.y(), 0); - this.maxSize = Vector3f.max(this.minSize, this.propertyMaxSize.size()); - markToRedraw(); - } @Override protected void onDraw() { @@ -397,5 +330,5 @@ public class Box extends Container { } super.onDraw(); } - + } diff --git a/src/main/org/atriasoft/ewol/widget/Box2.java b/src/main/org/atriasoft/ewol/widget/Box2.java new file mode 100644 index 0000000..34534f1 --- /dev/null +++ b/src/main/org/atriasoft/ewol/widget/Box2.java @@ -0,0 +1,334 @@ +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(""" + + + """.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(""" + + + """.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(); + } + +} diff --git a/src/main/org/atriasoft/ewol/widget/Button_old.java b/src/main/org/atriasoft/ewol/widget/Button_old.java deleted file mode 100644 index 11b81e0..0000000 --- a/src/main/org/atriasoft/ewol/widget/Button_old.java +++ /dev/null @@ -1,462 +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.aknot.annotation.AknotSignal; -import org.atriasoft.esignal.Connection; -import org.atriasoft.esignal.Signal; -import org.atriasoft.esignal.SignalEmpty; -import org.atriasoft.etk.Uri; -import org.atriasoft.etk.math.Vector3b; -import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.compositing.GuiShape; -import org.atriasoft.ewol.compositing.GuiShapeMode; -import org.atriasoft.ewol.compositing.ShapeBox; -import org.atriasoft.ewol.event.EventEntry; -import org.atriasoft.ewol.event.EventInput; -import org.atriasoft.ewol.event.EventTime; -import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.gale.key.KeyKeyboard; -import org.atriasoft.gale.key.KeyStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @ingroup ewolWidgetGroup - * Entry box display : - * - * ~~~~~~~~~~~~~~~~~~~~~~ - * ---------------------------------------------- - * | Text Label | - * ---------------------------------------------- - * ~~~~~~~~~~~~~~~~~~~~~~ - */ -public class Button_old extends ContainerToggle { - private static final Logger LOGGER = LoggerFactory.getLogger(Button_old.class); - - public enum ButtonLock { - LOCK_NONE, //!< normal status of the button - LOCK_WHEN_PRESSED, //!< When the state is set in pressed, the status stay in this one - LOCK_WHEN_RELEASED, //!< When the state is set in not pressed, the status stay in this one - LOCK_ACCESS, //!< all event are trashed == > acctivity of the button is disable - } - - public static Button_old createLabelButton(final String label) { - final Button_old out = new Button_old(); - final Label labelWidget = new Label(); - labelWidget.setPropertyFontSize(12); - labelWidget.setPropertyFill(Vector3b.FALSE); - labelWidget.setPropertyExpand(Vector3b.FALSE); - labelWidget.setPropertyGravity(Gravity.CENTER); - labelWidget.setPropertyValue(label); - out.setSubWidget(labelWidget, 0); - return out; - } - - public static Button_old createToggleLabelButton(final String label0, final String label1) { - final Button_old out = new Button_old(); - { - final Label labelWidget = new Label(); - labelWidget.setPropertyFill(Vector3b.FALSE); - labelWidget.setPropertyExpand(Vector3b.FALSE); - labelWidget.setPropertyGravity(Gravity.CENTER); - labelWidget.setPropertyValue(label0); - out.setSubWidget(labelWidget, 0); - } - { - final Label labelWidget = new Label(); - labelWidget.setPropertyFill(Vector3b.FALSE); - labelWidget.setPropertyExpand(Vector3b.FALSE); - labelWidget.setPropertyGravity(Gravity.CENTER); - labelWidget.setPropertyValue(label1); - out.setSubWidget(labelWidget, 1); - } - out.setPropertyToggleMode(true); - return out; - } - - /** - * Periodic call to update grapgic display - * @param event Time generic event - */ - protected static void periodicCall(final Button_old self, final EventTime event) { - LOGGER.trace("Periodic call on Entry(" + event + ")"); - if (!self.shape.periodicCall(event)) { - self.periodicConnectionHanble.close(); - } - self.markToRedraw(); - } - - /// Periodic call handle to remove it when needed - protected Connection periodicConnectionHanble = new Connection(); - - private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol"); - private boolean propertyValue = false; - private ButtonLock propertyLock = ButtonLock.LOCK_NONE; - private boolean propertyToggleMode = false; - private boolean propertyEnableSingle = false; - - protected ShapeBox shapeProperty = ShapeBox.ZERO; - private GuiShape shape; - - @AknotSignal - @AknotName(value = "down") - @AknotDescription("Button is Down") - public SignalEmpty signalDown = new SignalEmpty(); - @AknotSignal - @AknotName(value = "up") - @AknotDescription("Button is Up") - public SignalEmpty signalUp = new SignalEmpty(); - @AknotSignal - @AknotName(value = "click") - @AknotDescription("Button is Clicked") - public SignalEmpty signalClick = new SignalEmpty(); - @AknotSignal - @AknotName(value = "enter") - @AknotDescription("The cursor enter inside the button") - public SignalEmpty signalEnter = new SignalEmpty(); - @AknotSignal - @AknotName(value = "leave") - @AknotDescription("The cursor leave the button") - public SignalEmpty signalLeave = new SignalEmpty(); - @AknotSignal - @AknotName(value = "value") - @AknotDescription("The button value change") - public Signal signalValue = new Signal<>(); - - private boolean buttonPressed = false; - private boolean mouseHover = false; - - /** - * Constructor - */ - public Button_old() { - this.propertyCanFocus = true; - onChangePropertyShaper(); - // can not support multiple click... - setMouseLimit(1); - } - - @Override - public void calculateMinMaxSize() { - // call main class - super.calculateMinMaxSize(); - // get generic padding - Padding padding = Padding.ZERO; - if (this.shape != null) { - padding = this.shape.getPadding(); - } - calculateMinMaxSizePadded(padding); - LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize); - } - - protected void changeStatusIn(final GuiShapeMode newStatusId) { - if (this.shape.changeStatusIn(newStatusId)) { - if (!this.periodicConnectionHanble.isConnected()) { - //LOGGER.error("REQUEST: connection on periodic call"); - this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, - Button_old::periodicCall); - } - markToRedraw(); - } - - } - - void checkStatus() { - if (this.buttonPressed) { - changeStatusIn(GuiShapeMode.SELECT); - return; - } - if (this.mouseHover) { - changeStatusIn(GuiShapeMode.OVER); - return; - } - if (this.propertyValue) { - changeStatusIn(GuiShapeMode.NORMAL); - } - changeStatusIn(GuiShapeMode.NONE); - } - - @AknotManaged - @AknotAttribute - @AknotName(value = "config") - @AknotDescription(value = "configuration of the widget") - public Uri getPropertyConfig() { - return this.propertyConfig; - } - - @AknotManaged - @AknotAttribute - @AknotName(value = "lock") - @AknotDescription(value = "Lock the button in a special state to permit changing state only by the coder") - public ButtonLock getPropertyLock() { - return this.propertyLock; - } - - @AknotManaged - @AknotAttribute - @AknotName(value = "value") - @AknotDescription(value = "Value display in the entry (decorated text)") - public boolean getPropertyValue() { - return this.propertyValue; - } - - @AknotManaged - @AknotAttribute - @AknotName(value = "enable-single") - @AknotDescription(value = "If one element set in the Button ==> display only set") - public boolean isPropertyEnableSingle() { - return this.propertyEnableSingle; - } - - @AknotManaged - @AknotAttribute - @AknotName(value = "toggle") - @AknotDescription(value = "The button can toggle") - public boolean isPropertyToggleMode() { - return this.propertyToggleMode; - } - - void onChangePropertyEnableSingle() { - if (this.propertyEnableSingle) { - if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) { - this.idWidgetDisplayed = 1; - } else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) { - this.idWidgetDisplayed = 0; - } else if (this.subWidget[0] == null && this.subWidget[1] == null) { - this.idWidgetDisplayed = 0; - } - } - } - - void onChangePropertyLock() { - if (ButtonLock.LOCK_ACCESS == this.propertyLock) { - this.buttonPressed = false; - this.mouseHover = false; - } - checkStatus(); - markToRedraw(); - } - - protected void onChangePropertyShaper() { - if (this.shape == null) { - this.shape = new GuiShape(this.propertyConfig); - } else { - this.shape.setSource(this.propertyConfig); - } - markToRedraw(); - } - - void onChangePropertyToggleMode() { - this.propertyValue = !this.propertyValue; - this.signalValue.emit(this.propertyValue); - if (!this.propertyToggleMode) { - this.idWidgetDisplayed = 0; - } else if (!this.propertyValue) { - this.idWidgetDisplayed = 0; - } else { - this.idWidgetDisplayed = 1; - } - if (this.propertyEnableSingle) { - if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) { - this.idWidgetDisplayed = 1; - } else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) { - this.idWidgetDisplayed = 0; - } - } - checkStatus(); - markToRedraw(); - } - - protected void onChangePropertyValue() { - if (this.propertyToggleMode) { - if (!this.propertyValue) { - this.idWidgetDisplayed = 0; - } else { - this.idWidgetDisplayed = 1; - } - } - if (this.propertyEnableSingle) { - if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) { - this.idWidgetDisplayed = 1; - } else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) { - this.idWidgetDisplayed = 0; - } - } - checkStatus(); - markToRedraw(); - } - - @Override - public void onChangeSize() { - final Padding padding = this.shape.getPadding(); - onChangeSizePadded(padding); - } - - @Override - protected void onDraw() { - if (this.shape != null) { - this.shape.draw(true); - } - super.onDraw(); - } - - @Override - protected boolean onEventEntry(final EventEntry event) { - //LOGGER.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if (event.type() == KeyKeyboard.CHARACTER && event.status() == KeyStatus.down && event.getChar() == '\r') { - this.signalEnter.emit(); - return true; - } - return super.onEventEntry(event); - } - - @Override - public boolean onEventInput(final EventInput event) { - final Vector3f relPos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); - LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos); - final boolean over = this.shapeProperty.isInside(relPos); - //filter if outside the element... - if (event.status() == KeyStatus.leave) { - changeStatusIn(GuiShapeMode.NORMAL); - this.buttonPressed = false; - return true; - } - if (event.inputId() == 0) { - if (!this.buttonPressed) { - if (KeyStatus.leave == event.status()) { - changeStatusIn(GuiShapeMode.NORMAL); - } else { - LOGGER.trace("Detect Over : " + this.shapeProperty); - if (over) { - changeStatusIn(GuiShapeMode.OVER); - } else { - changeStatusIn(GuiShapeMode.NORMAL); - } - } - return true; - } - } - if (event.inputId() != 1) { - return false; - } - if (KeyStatus.pressSingle == event.status() && over) { - keepFocus(); - this.signalClick.emit(); - if (this.propertyToggleMode) { - setPropertyValue(!this.propertyValue); - } else { - setPropertyValue(!this.propertyValue); - setPropertyValue(!this.propertyValue); - } - return true; - } - if (KeyStatus.down == event.status() && over) { - keepFocus(); - this.buttonPressed = true; - changeStatusIn(GuiShapeMode.SELECT); - markToRedraw(); - this.signalDown.emit(); - return true; - } - if (KeyStatus.move == event.status() && over) { - keepFocus(); - markToRedraw(); - return true; - } - if (KeyStatus.up == event.status() && this.buttonPressed) { - keepFocus(); - this.buttonPressed = false; - this.signalUp.emit(); - changeStatusIn(GuiShapeMode.OVER); - markToRedraw(); - return true; - } - return false; - } - - @Override - protected void onLostFocus() { - this.buttonPressed = false; - LOGGER.trace(this.name + " : Remove Focus ..."); - checkStatus(); - } - - @Override - public void onRegenerateDisplay() { - super.onRegenerateDisplay(); - if (!needRedraw()) { - //return; - } - //LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'"); - this.shape.clear(); - final Padding padding = this.shape.getPadding(); - - Vector3f tmpSizeShaper = this.minSize; - Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); - if (this.propertyFill.x()) { - tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); - delta = delta.withX(0.0f); - } - if (this.propertyFill.y()) { - tmpSizeShaper = tmpSizeShaper.withY(this.size.y()); - delta = delta.withY(0.0f); - } - if (this.propertyFill.z()) { - tmpSizeShaper = tmpSizeShaper.withZ(this.size.y()); - delta = delta.withZ(0.0f); - } - - Vector3f tmpOriginShaper = delta; - Vector3f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y(), padding.z()); - //Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f); - Vector3f tmpOriginText = new Vector3f(0, 0, 0); - // not sure this is needed... - tmpSizeShaper = tmpSizeShaper.clipInteger(); - tmpOriginShaper = tmpOriginShaper.clipInteger(); - tmpSizeText = tmpSizeText.clipInteger(); - tmpOriginText = tmpOriginText.clipInteger(); - - this.shapeProperty = new ShapeBox(tmpOriginShaper, tmpSizeShaper, padding); - this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText); - this.shape.flush(); - - } - - public void setPropertyConfig(final Uri propertyConfig) { - if (this.propertyConfig.equals(propertyConfig)) { - return; - } - this.propertyConfig = propertyConfig; - onChangePropertyShaper(); - } - - public void setPropertyEnableSingle(final boolean propertyEnableSingle) { - this.propertyEnableSingle = propertyEnableSingle; - markToRedraw(); - } - - public void setPropertyLock(final ButtonLock propertyLock) { - this.propertyLock = propertyLock; - markToRedraw(); - } - - public void setPropertyToggleMode(final boolean propertyToggleMode) { - this.propertyToggleMode = propertyToggleMode; - markToRedraw(); - } - - public void setPropertyValue(final boolean propertyValue) { - if (this.propertyValue == propertyValue) { - return; - } - this.propertyValue = propertyValue; - this.signalValue.emit(this.propertyValue); - onChangePropertyValue(); - } - -} diff --git a/src/main/org/atriasoft/ewol/widget/CheckBox.java b/src/main/org/atriasoft/ewol/widget/CheckBox.java index fb789a7..27c3d19 100644 --- a/src/main/org/atriasoft/ewol/widget/CheckBox.java +++ b/src/main/org/atriasoft/ewol/widget/CheckBox.java @@ -12,28 +12,29 @@ import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.widget.Sizer.DisplayMode; public class CheckBox extends Container { - + protected static void eventLabelClick(final CheckBox self) { self.tick.setPropertyValue(!self.tick.getPropertyValue()); self.signalClick.emit(); } - + protected static void eventTickClick(final CheckBox self) { + self.tick.setPropertyValue(!self.tick.getPropertyValue()); self.signalClick.emit(); } - + protected static void eventTickDown(final CheckBox self) { self.signalDown.emit(); } - + protected static void eventTickUp(final CheckBox self) { self.signalUp.emit(); } - + protected static void eventTickValue(final CheckBox self, final Boolean value) { self.signalValue.emit(value); } - + @AknotSignal @AknotName("down") @AknotDescription("CheckBox is Down") @@ -52,17 +53,17 @@ public class CheckBox extends Container { public Signal signalValue = new Signal<>(); final Tick tick; final Label label; - + public CheckBox() { this("No Label"); } - + public CheckBox(final String basicLabel) { final Sizer subs = new Sizer(DisplayMode.HORIZONTAL); subs.setPropertyLockExpand(Vector3b.TRUE); subs.setPropertyGravity(Gravity.CENTER); setSubWidget(subs); - + this.tick = new Tick(); this.tick.setPropertyExpand(new Vector3b(false, true, true)); this.tick.setPropertyFill(Vector3b.FALSE); @@ -72,7 +73,7 @@ public class CheckBox extends Container { this.tick.signalUp.connectAuto(this, CheckBox::eventTickUp); this.tick.signalDown.connectAuto(this, CheckBox::eventTickDown); this.tick.signalValue.connectAuto(this, CheckBox::eventTickValue); - + this.label = new Label(basicLabel); this.label.setPropertyExpand(Vector3b.TRUE); this.label.setPropertyFill(Vector3b.FALSE); @@ -80,7 +81,7 @@ public class CheckBox extends Container { subs.subWidgetAdd(this.label); this.label.signalPressed.connectAuto(this, CheckBox::eventLabelClick); } - + @AknotManaged //@AknotText @AknotAttribute @@ -89,7 +90,7 @@ public class CheckBox extends Container { public String getPropertyLabel() { return this.label.getPropertyValue(); } - + @AknotManaged @AknotAttribute @AknotName(value = "value") @@ -97,13 +98,13 @@ public class CheckBox extends Container { public Boolean getPropertyValue() { return this.tick.getPropertyValue(); } - + public void setPropertyLabel(final String value) { this.label.setPropertyValue(value); } - + public void setPropertyValue(final Boolean value) { this.tick.setPropertyValue(value); } - + } diff --git a/src/main/org/atriasoft/ewol/widget/Tick.java b/src/main/org/atriasoft/ewol/widget/Tick.java index a54a4a5..3dd4d6a 100644 --- a/src/main/org/atriasoft/ewol/widget/Tick.java +++ b/src/main/org/atriasoft/ewol/widget/Tick.java @@ -169,6 +169,7 @@ public class Tick extends Box { public boolean onEventInput(final EventInput event) { final Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0); final Vector3f relPos = relativePosition(positionAbsolute); + System.out.println("Event on Input ... " + event + " relPos = " + relPos); LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos); final boolean over = checkIfOver(relPos); //filter if outside the element... @@ -197,6 +198,7 @@ public class Tick extends Box { } if (KeyStatus.pressSingle == event.status() && over) { keepFocus(); + System.out.println("event ...."); this.signalClick.emit(); setPropertyValue(!this.propertyValue); return true;