Open chhetrirahul opened 8 years ago
Hi @chhetrirahul I too had the same requirement. So changed code like this :
Comment suggested code in ImageMap.java
@Override public boolean onSingleTapUp(MotionEvent e) { boolean superCallResult = super.onSingleTapUp(e); if (!superCallResult) { int x = (int) ((e.getX() - dx) / scale); int y = (int) ((e.getY() - dy) / scale); // Comment this lines // float targetScale = initScale * 3; // if (scale < targetScale) { // scaleTo(x, y, targetScale); // } else { int length = areaPaths.length; Region region = this.region; RectF bounds = this.bounds; Path[] areaPaths = this.areaPaths; for (int i = 0; i < length; i++) { Path areaPath = areaPaths[i]; areaPath.computeBounds(bounds, false); region.set((int) bounds.left, (int) bounds.top, (int) bounds.right, (int) bounds.bottom); if (region.contains(x, y)) { region.setPath(areaPath, region); if (region.contains(x, y)) { if (imageMapListener != null) { imageMapListener.onAreaClicked(i); } return true; } } } // } } return superCallResult; }
Add following function in BigImage.java & call it whenever you need it
/** * Zooms map out to initial stage * * @return false if already in initial stage, true otherwise */ public boolean resetToOverviewMode() { if (scale <= initScale) return false; else { scale(0); return true; } }
Hi @chhetrirahul I too had the same requirement. So changed code like this :
Comment suggested code in ImageMap.java
Add following function in BigImage.java & call it whenever you need it