I have a FloorView, and within this FloorView I'll be filling it with RoomViews. Every floor has rooms. I want a functionality that can allow the user to zoom in on the floor, and see the rooms up closer. Think of it as Google maps. The earth is the floor, and the buildings/road are the rooms
The floor is huge, will have many rooms, that's why I want the ability to zoom in. How can I achieve this? I want the zoom functionality to be the exact same from Google maps; using two fingers
I have already built a FloorView, and a RoomView. I have tried Googling, and spotted a library that allows zooms for an ImageView, which is not what I need. I'm at a loss, I cannot find other sources
Here's my code
FloorView.kt
class FloorView(context: Context, attrs: AttributeSet) : View(context, attrs) {
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = Paint.Style.FILL_AND_STROKE
color = Color.RED
}
private val screenHeight = context.resources.displayMetrics.heightPixels
private val screenWidth = context.resources.displayMetrics.widthPixels
private val rectangle = RectF(screenWidth.toFloat(), screenHeight.toFloat(), 0f, 0f)
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas!!.drawRect(rectangle, paint)
}
}
RoomView.kt
class RoomView(context: Context, attrs: AttributeSet) : View(context, attrs) {
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = Paint.Style.FILL_AND_STROKE
color = Color.CYAN
}
private val rectangle = RectF(1000f, 1000f, 0f, 0f)
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas!!.drawRect(rectangle, paint)
}
}
Thank you for helping me