diff --git a/README.md b/README.md index 3f6b0206..cbf6e1a1 100644 --- a/README.md +++ b/README.md @@ -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 ); +``` diff --git a/demo/src/main/java/tileview/demo/RealMapTileViewActivity.java b/demo/src/main/java/tileview/demo/RealMapTileViewActivity.java index e7f49041..dade680d 100644 --- a/demo/src/main/java/tileview/demo/RealMapTileViewActivity.java +++ b/demo/src/main/java/tileview/demo/RealMapTileViewActivity.java @@ -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 ); diff --git a/demo/src/main/res/drawable/bg_gray_bordered.xml b/demo/src/main/res/drawable/bg_gray_bordered.xml new file mode 100644 index 00000000..f7d0c9ae --- /dev/null +++ b/demo/src/main/res/drawable/bg_gray_bordered.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/tileview/src/main/java/com/qozix/tileview/widgets/ScalingLayout.java b/tileview/src/main/java/com/qozix/tileview/widgets/ScalingLayout.java index ab7089ac..57371f7a 100644 --- a/tileview/src/main/java/com/qozix/tileview/widgets/ScalingLayout.java +++ b/tileview/src/main/java/com/qozix/tileview/widgets/ScalingLayout.java @@ -18,6 +18,9 @@ public class ScalingLayout extends ViewGroup { public ScalingLayout( Context context ) { super( context ); setWillNotDraw( false ); + + + } /** diff --git a/tileview/src/main/java/com/qozix/tileview/widgets/ZoomPanLayout.java b/tileview/src/main/java/com/qozix/tileview/widgets/ZoomPanLayout.java index fcb9614a..0272e270 100644 --- a/tileview/src/main/java/com/qozix/tileview/widgets/ZoomPanLayout.java +++ b/tileview/src/main/java/com/qozix/tileview/widgets/ZoomPanLayout.java @@ -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 ) {