Skip to content

Spacing option not working on iOS #189

Description

@daveadotdev

Ok, I now officially feel bad for submitting 3 issues in 3 days >.> I should probably figure out how to do Pull Requests so I can make things easier in the future for people like you!

Here's another one having to do with the 'spacing' option.

Basically, if you set spacing=2 for example, on mobile (aka touchy), the spacing is not applied. The line in question is related to this mobile customization (starting on line 879):

if (touchy){
  // workaround for downsizing-sprites-bug-in-iPhoneOS inspired by Katrin Ackermann
  css(___+dot(klass), { WebkitBackgroundSize: get(_images_).length
    ? !stitched ? undefined : px(stitched)+___+px(space.y)
    : stitched && px(stitched)+___+px((space.y + opt.spacing) * rows - opt.spacing)
    || px(space.x * opt.footage)+___+px(space.y * get(_rows_) * rows * (opt.directional? 2:1))
  });

This basically forces the mobile browser to scale the background image explicitly to the desired size. However, the spacing option is not included in the calculation for the x size, so in my case it was being set to a size that was opt.footage*opt.spacing too narrow. The fix (on the last line):

if (touchy){
  // workaround for downsizing-sprites-bug-in-iPhoneOS inspired by Katrin Ackermann
  css(___+dot(klass), { WebkitBackgroundSize: get(_images_).length
    ? !stitched ? undefined : px(stitched)+___+px(space.y)
    : stitched && px(stitched)+___+px((space.y + opt.spacing) * rows - opt.spacing)
    || px((space.x + opt.spacing) * opt.footage)+___+px(space.y * get(_rows_) * rows * (opt.directional? 2:1))
  });

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions