Something like: https://github.com/fredj/ol3/commit/5cd21599654de4fdf0c4df0552b0fc3b7fed7855