blob: 101afe4b70ace6b619b7eb0bf5b19eea81e68381 (
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
47
48
49
|
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) {
if (!isVisible()) {
return false;
}
return onHitTest(x, y);
}
}
|