Update git submodules
[LibreOffice.git] / android / source / src / java / org / libreoffice / canvas / CommonCanvasElement.java
blob6b40ae4ba905562e9ac1db94aa3c35843df754ec
1 package org.libreoffice.canvas;
3 import android.graphics.Canvas;
5 /**
6 * Common implementation to canvas elements.
7 */
8 public abstract class CommonCanvasElement implements CanvasElement, CanvasElementImplRequirement {
10 private boolean mVisible = false;
12 /**
13 * Is element visible?
15 @Override
16 public boolean isVisible() {
17 return mVisible;
20 /**
21 * Set element visibility.
23 @Override
24 public void setVisible(boolean visible) {
25 mVisible = visible;
28 /**
29 * Trigger drawing the element on the canvas.
31 @Override
32 public void draw(Canvas canvas) {
33 if (isVisible()) {
34 onDraw(canvas);
38 /**
39 * Hit test. Return true if the element was hit. Directly return false if
40 * the element is invisible.
42 @Override
43 public boolean contains(float x, float y) {
44 return isVisible() && onHitTest(x, y);