Tangram View becomes ready when a canvas has a legit size (non zero x and y dimensions) 72/88672/1
authorVarun <tallytalwar@gmail.com>
Tue, 20 Sep 2016 07:37:09 +0000 (03:37 -0400)
committerVarun <tallytalwar@gmail.com>
Tue, 20 Sep 2016 07:37:09 +0000 (03:37 -0400)
Change-Id: Idef25b2afd5ee49cc7e1f7ba4d3198be29924e2f

src/mapzen/tangram_view.cpp

index fe7686e..8a109f8 100644 (file)
@@ -134,7 +134,6 @@ mapzen_error_e TangramView::create(maps_view_h view, maps_plugin_map_view_ready_
        m_map->setupGL();
 
        m_map->resize(m_w, m_h);
-       readyMapCb((void*)view);
 
        m_isInitialized = true;
 
@@ -245,6 +244,10 @@ mapzen_error_e TangramView::render(maps_view_h view, const maps_coordinates_h co
        m_h = MAX(m_h, 1);
 
        if (x != m_x || y != m_y || w != m_w || h != m_h) {
+               if (m_x == 0 && m_y == 0 && x > 0 && y > 0) {
+                       // Send a tangram view ready callback when we have a legit canvas size
+                       readyMapCb((void*)view);
+               }
                m_x = x;
                m_y = y;
                m_w = w;