Fix favicon on HiDPI displays

pull/1036/head
Jasper van Merle 6 years ago
parent 8d57c48b18
commit c01982ca9a

@ -13,5 +13,6 @@ app.config =
version: <%= Time.now.to_i %>
release: <%= Time.now.utc.httpdate.to_json %>
mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css'
favicon_spritesheet: '<%= image_path('sprites/docs.png') %>'
service_worker_path: '/service-worker.js'
service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %>

@ -30,8 +30,8 @@ withImage = (url, action) ->
styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')
bgUrl = styles['background-image'].slice(5, -2)
sourceSize = if bgUrl.includes('@2x') then 32 else 16
bgUrl = app.config.favicon_spritesheet
sourceSize = 16
sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2)))
sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2)))

Loading…
Cancel
Save