Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
moagrius committed Oct 25, 2015
1 parent 1bbfa2b commit 1ba17b7
Showing 5 changed files with 33 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -204,5 +204,23 @@ tileView.addHotSpot( hotSpot, new HotSpot.HotSpotTapListener(){

####Paths

TileView uses `DrawablePath` instances to draw paths above the tile layer. Paths will transform
with the TileView as it scales, but do not deform - that's to say that a 10DP wide stroke will
always be 10DP wide, but the points of the path will be scaled with the TileView.

`DrawablePath` instances are objects that relate an instance of `android.graphics.Path` with an
instance of `android.graphics.Paint` - there is no additional direct access API. Scaling is
managed by a singel instance of `CompositePathView`, which also supplies a default `Paint`
instance that's used if any individual `DrawablePath` has a `null` value for it `paint` property.

Paths are not Views, and cannot be clicked. It is possible, however, to use the same `Path`
instance on a `HotSpot` and a `DrawablePath`.

To add a path:

```
DrawablePath drawablePath = new DrawablePath();
drawablePath.path = // generate a Path using the standard android.graphics.Path API
drawablePath.paint = // generate a Paint instance use the standard android.graphics.Paint API
tileView.addPath( drawablePath );
```
2 changes: 2 additions & 0 deletions demo/src/main/java/tileview/demo/RealMapTileViewActivity.java
Original file line number Diff line number Diff line change
@@ -102,6 +102,8 @@ public void onCreate( Bundle savedInstanceState ) {
// test higher than 1
tileView.setScaleLimits( 0, 2 );

tileView.getTileCanvasViewGroup().setBackgroundResource( R.drawable.bg_gray_bordered );

// start small and allow zoom
//tileView.setScale( 0.3f );

9 changes: 9 additions & 0 deletions demo/src/main/res/drawable/bg_gray_bordered.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">


<stroke android:width="10dp"
android:color="#FF0000" />


</shape>
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ public class ScalingLayout extends ViewGroup {
public ScalingLayout( Context context ) {
super( context );
setWillNotDraw( false );



}

/**
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ protected void onLayout( boolean changed, int l, int t, int r, int b ) {
for( int i = 0; i < getChildCount(); i++ ) {
View child = getChildAt( i );
if( child.getVisibility() != GONE ) {
child.layout( 0, 0, mScaledWidth, mScaledHeight);
child.layout( 0, 0, mScaledWidth - 50, mScaledHeight - 50);
}
}
if( changed ) {

0 comments on commit 1ba17b7

Please sign in to comment.