Coder Social home page Coder Social logo

pierredarrieutort / fitext Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 4.0 6.33 MB

Resizes text elements proportionally to fit any element

Home Page: https://pierredarrieutort.github.io/fitext

License: ISC License

JavaScript 36.68% HTML 24.10% SCSS 39.22%

fitext's Introduction

Hi ๐Ÿ‘‹, I'm Pierre

A frontend interactive developer from Bordeaux, France


  • ๐Ÿ”ญ Iโ€™m currently working on a lot of tools at HelloAsso

  • ๐ŸŒฑ Iโ€™m currently learning ThreeJS, GLSL

  • ๐Ÿ‘จโ€๐Ÿ’ป A lot of my projects are available in this GitHub & coming soon on my new portfolio !

  • ๐Ÿ’ฌ Ask me about JS, GSAP, BarbaJS, full-stack stuffs

  • ๐Ÿ“ซ How to reach me : [email protected] or by LinkedIn

fitext's People

Contributors

geopic avatar osdevisnot avatar pierredarrieutort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fitext's Issues

fitext hangs firefox in android

Accessing the demo from firefox android
https://pierredarrieutort.github.io/fitext/

The offending line is
update_font_size = (child, reversed) => child.style.fontSize = ${parseFloat(getComputedStyle(child).fontSize) + (reversed ? -stagger : stagger)}px

It happens on the reversed -stagger case. For some reason using a too low stagger,
say 1 or 2 the result actually increases the font size. This results in infinite loop increasing
the font size. I tried a piece of code of mine and using a stagger 10 did actually decreased the font.
Fixing the issue.

But still I think there is something fitext code is not considering. Or firefox maybe.
I traced style.fontSize and getComputedStyle(...).fontSize and they tended to have a
considerable gap of px. This gap grows with the ever increasing font-size too.

Im not sure about using a bigger stagger. My guess is that fitext loses font-size granularity.

Infinite loop when trying reducing the height of the fitter container to the minimum

Expected behaviour

The font size should reduce to the very least (even if not even visible I guess?) when extremely reducing the height of a container.

Actual behaviour

The website stops responding. From what I could notice, this is probably due to an infinite loop trying to update the children font sizes while it's still overflowing...

How to reproduce

Go to the project's demo and try reducing the height to the minimum (it get stuck around a height of 20% (for a width of 60%) if your doing it slowly, but the values don't matter much, it's rather the action of reducing the height to its minimum).

Specifications (just in case)

  • Version: fitext v1.0.5
  • Browser: Google Chrome 81.0.4044.138
  • OS: macOS 10.12.6

TypeScript type declaration file

If you want I can write a TypeScript type declaration file for this package so that TS developers can utilise the type-checking feature of the language as they use this package. Let me know if you are interested.

Example doesn't work

File 'fitext.min.js' not found. There is also no .min. file provided. In 'dist' -folder I just can find .cjs. .esm. and .umd. files. No one of them works. :-(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.