Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SpectralDragon/Minimap
Minimap for your PKCanvasView!
https://github.com/SpectralDragon/Minimap
canvas ios minimap pencilkit swift swift-library swift5 swiftui uiwindow
Last synced: 3 months ago
JSON representation
Minimap for your PKCanvasView!
- Host: GitHub
- URL: https://github.com/SpectralDragon/Minimap
- Owner: SpectralDragon
- License: mit
- Created: 2019-07-21T01:40:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-21T12:09:34.000Z (over 5 years ago)
- Last Synced: 2024-04-04T18:31:35.823Z (7 months ago)
- Topics: canvas, ios, minimap, pencilkit, swift, swift-library, swift5, swiftui, uiwindow
- Language: Swift
- Size: 3.94 MB
- Stars: 59
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minimap
Minimap is light way to represent your canvas to mini map.
[![Swift 5.1](https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat)](https://swift.org/)
For base I used PKToolPicker API and Minimap works and looks like PKToolPicker.
## Features
- [x] Floating minimap
- [x] Customization
- [x] Dark theme support
- [x] PKToolPicker API
- [x] Orienation support![Example](https://github.com/SpectralDragon/Minimap/raw/master/preview.gif)
## Requirements
Minimap is written in Swift 5.1 and is available on iOS 13.## Usage
For get instance Minimap using `Minimap.shared(for: UIWindow)`
Example:
```swift
if let minimap = Minimap.shared(for: self.view.window) {
PKToolPicker.shared(for: window)?.addObserver(minimap) // For handling PKToolPicker frame
minimap.observeCanvasView(canvasView) // For handling content changing
minimap.setVisible(!minimap.isVisible, forFirstResponder: canvasView) // Set visible for minimap
canvasView.becomeFirstResponder()
minimap.tintColor = .green // Set visible zone color
}
```
Minimap will automaticly hidden if responder will resign.## How it's works?
Minimap subscribe to canvas properties like `contentSize`, `contentOffset` and etc. and present new `MinimapHostWindow` for presenting minimap without adding like subview to your views.