GoogleChromeLabs / pinch-zoom

Apache License 2.0
372 stars 54 forks source link

Add minScale attribute/property #6

Closed kenchris closed 5 years ago

kenchris commented 5 years ago

This allows to get a .minScale property or configure it declaratively using an attribute like

<pinch-zoom min-scale=1>
  <h1>Hello!</h1>
</pinch-zoom>

@PaulKinlan

If I generate the dist, the resulting .mjs file has wrong eol's (^M all over)

jakearchibald commented 5 years ago

Nice! It feels like the attribute should be the source of truth, as this matches HTML behaviour.

kenchris commented 5 years ago

So you mean to ignore the property value if attribute is set? I can make that change. Or did you want setting the property to reflect to the attribute?

jakearchibald commented 5 years ago

As in setting the property sets the attribute. Reading the property reads from the attribute (and coverts the type). Eg https://github.com/GoogleChromeLabs/two-up/blob/master/lib/two-up.ts#L120

kenchris commented 5 years ago

As we are storing in attributes now, I added caching to avoid the "expensive" conversion as the value is checked in _updateTransform

https://w3ctag.github.io/webcomponents-design-guidelines/ : image

jakearchibald commented 5 years ago

LGTM, thanks!

jakearchibald commented 5 years ago

Published as 1.1.0.