blob: 6b40ae4ba905562e9ac1db94aa3c35843df754ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package org.libreoffice.canvas;
import android.graphics.Canvas;
/**
* Common implementation to canvas elements.
*/
public abstract class CommonCanvasElement implements CanvasElement, CanvasElementImplRequirement {
private boolean mVisible = false;
/**
* Is element visible?
*/
@Override
public boolean isVisible() {
return mVisible;
}
/**
* Set element visibility.
*/
@Override
public void setVisible(boolean visible) {
mVisible = visible;
}
/**
* Trigger drawing the element on the canvas.
*/
@Override
public void draw(Canvas canvas) {
if (isVisible()) {
onDraw(canvas);
}
}
/**
* Hit test. Return true if the element was hit. Directly return false if
* the element is invisible.
*/
@Override
public boolean contains(float x, float y) {
return isVisible() && onHitTest(x, y);
}
}
|