From daac03f5269b0c000ca06db56e65118238b92bd7 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Fri, 7 Feb 2014 11:40:15 -0500 Subject: [PATCH] fixes #43: fix tile renders on OS X --- macosx/main.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/macosx/main.mm b/macosx/main.mm index 1c12b7f3c..b8f333ba2 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -7,6 +7,8 @@ #include +NSString *const MBXNeedsRenderNotification = @"MBXNeedsRenderNotification"; + class MapView { public: MapView() : @@ -53,6 +55,14 @@ public: glfwSetScrollCallback(window, scroll); glfwSetCharCallback(window, character); glfwSetKeyCallback(window, key); + + [[NSNotificationCenter defaultCenter] addObserverForName:MBXNeedsRenderNotification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *notification) + { + dirty = true; + }]; } static void character(GLFWwindow *window, unsigned int codepoint) { @@ -241,6 +251,7 @@ void request_http(std::string url, std::function func) { Response res; func(res); } + [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; }]; } @@ -263,6 +274,7 @@ void request_http(std::string url, std::function func, std::fun func(res); cb(); + [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; }]; }