Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(markerManager.swift): 修复issues758提到的问题 #779

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/ios/MapView/MarkerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class Marker: UIView {
* 于是索性把 subview 渲染成 image,原来用 subview 带来的 offset、点击问题也都不用处理了。
* 正常情况下就把 subview 的 opacity 设成 0,需要渲染的时候才设成 1,渲染然后马上设回 0。
*/
func update() {
if centerOffset == nil, view != nil {

func update() {
if view != nil {
iconView?.layer.opacity = 1
let renderer = UIGraphicsImageRenderer(bounds: iconView!.bounds)
view?.image = renderer.image { context in layer.render(in: context.cgContext) }
Expand All @@ -77,6 +78,9 @@ class Marker: UIView {
let size: CGSize = (view?.image.size)!
view?.centerOffset = CGPoint(x: 0, y: -size.height / 2)
}
if centerOffset != nil {
view?.centerOffset = centerOffset!
}
}

func getView() -> MAAnnotationView {
Expand Down