void checkClicked(Drawable drw, float x, float y) { if (!drw.checkPoint(x, y)) { return; } //loop backward if (drw is CompositeDrawable) { CompositeDrawable cd = (CompositeDrawable)drw; //todo: apply inverse transformation for (int i = cd.clickables.Count - 1; i >= 0; i--) { checkClicked(cd.clickables[i], x, y); if (clickHandled) { return; //don't continue looping } } } //fire if (clickHandled) { return; } clickHandled = drw.fireClick(x, y); }
public DrawablePoint scaleToParent(CompositeDrawable parent) { trnsX = (int)((float)Vx * ((float)parent.absWidth / (float)parent.maxX)); absX = parent.absX + trnsX; // trnsY = (int)((float)Vy * ((float)parent.absHeight / (float)parent.maxY)); absY = parent.absY + trnsY; // return(this); }
void checkHovered(Drawable drw, float x, float y) { if (!drw.checkPoint(x, y)) { return; } //loop backward if (drw is CompositeDrawable) { CompositeDrawable cd = (CompositeDrawable)drw; //todo: apply inverse transformation for (int i = cd.clickables.Count - 1; i >= 0; i--) { checkHovered(cd.clickables[i], x, y); if (hoverHandled) { return; } } } //fire hoverHandled = drw.fireHover(); }
/// <summary> /// adds this instance to the param parent, just equivalent to parent.add(this) /// </summary> public Drawable addTo(CompositeDrawable parent) { parent.add(this); return(this); }