{"action":"closed","issue":{"url":"https://api.github.com/repos/openlayers/ol3/issues/5456","repository_url":"https://api.github.com/repos/openlayers/ol3","labels_url":"https://api.github.com/repos/openlayers/ol3/issues/5456/labels{/name}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/5456/comments","events_url":"https://api.github.com/repos/openlayers/ol3/issues/5456/events","html_url":"https://github.com/openlayers/ol3/issues/5456","id":159567275,"number":5456,"title":"Need delay for using getPixelFromCoordinate","user":{"login":"cs09g","id":7428017,"avatar_url":"https://avatars.githubusercontent.com/u/7428017?v=3","gravatar_id":"","url":"https://api.github.com/users/cs09g","html_url":"https://github.com/cs09g","followers_url":"https://api.github.com/users/cs09g/followers","following_url":"https://api.github.com/users/cs09g/following{/other_user}","gists_url":"https://api.github.com/users/cs09g/gists{/gist_id}","starred_url":"https://api.github.com/users/cs09g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs09g/subscriptions","organizations_url":"https://api.github.com/users/cs09g/orgs","repos_url":"https://api.github.com/users/cs09g/repos","events_url":"https://api.github.com/users/cs09g/events{/privacy}","received_events_url":"https://api.github.com/users/cs09g/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-10T06:29:13Z","updated_at":"2016-06-10T08:41:28Z","closed_at":"2016-06-10T08:41:28Z","body":"Hi, I'm newbie at OL3.\r\n\r\nI was trying to use this function just after the map is initialized.\r\nBut, I could not due to frameState == null.\r\nmaybe the function is for inner logic, or for something else, so it cause this kind of situation when user access the function directly.\r\n\r\nActually, get pixel from coordination is kind of math. So it shouldn't be waiting until the map really rendered on the screen. for only calculation!\r\n\r\nso, I just overrided the function and it may be helpful for someone like me. and you team can refer this.\r\n\r\n```\r\nol.Map.prototype.getPixelFromCoordinate = function(coordinate, resolution, rotation) {\r\n  var frameState = this.frameState_;\r\n  var coords = coordinate.slice(0, 2);\r\n\r\n  var coordinateToPixelMatrix = [];\r\n\r\n  if (frameState) {\r\n  \tcoordinateToPixelMatrix = frameState.coordinateToPixelMatrix;\r\n  } else {\r\n    coordinateToPixelMatrix = ol.vec.Mat4.makeTransform2D(\r\n\t  \tgoog.vec.Mat4.createNumber(), \r\n\t  \tthis.viewport_.clientWidth / 2, this.viewport_.clientHeight / 2,\r\n\t  \t1 / resolution, -1 / resolution,\r\n\t  \t-rotation,\r\n\t  \t-coords[0], -coords[1])\r\n  }\r\n\r\n  return ol.vec.Mat4.multVec2(coordinateToPixelMatrix, coords, coords);\r\n};\r\n```"}}
{"actor":{"display_login":"ahocevar"}}