Code Monkey home page Code Monkey logo

calculate-size's People

Contributors

alexpaxton avatar atipunov avatar rockon404 avatar schickling avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

calculate-size's Issues

Source Map Errors in CRA 5.0

In CRA 5.0, the build will fail when using this library stating:

WARNING in ./node_modules/calculate-size/lib/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/austin/dev/asdf/ui/node_modules/calculate-size/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/austin/dev/asdf/ui/node_modules/calculate-size/src/index.ts'

Reference: facebook/create-react-app#11752

missing main section in bower.json

Hi, I am using your module and it works quite ok, but I found a minor issue when building my app with grunt.

I receive the following message:

Running "wiredep:app" (wiredep) task
app/index.html modified.

calculate-size was not injected in your file.
Please go take a look in "<path>/bower_components/calculate-size" for the file you need, then manually include it in your file.  

I can not add that manually, because wiredep cleans and rebuilds the section of the installed bower modules. The fix is to add the following code in the bower.json

"main": [
      "./src/calculate-size.js"
  ],

Multiple spaces counted as 1

"Hello World" and "Hello World" have the same width. Looks like it is only counting all the spaces as one space.

Newlines not measured

Not sure if it's in the scope of the library but I've stumbled upon this.

If a string contains newlines like 'ab\ncdefg' should width and height be max of width, height per line?

|ab.  | ⏫  h
|cdefg| ⏬ 
 <--->
   w

How to import this in Angular5?

By using npm install, I obtained a ts file and a js file.
I tried using the following code in my ts file
import { calculateSize } from 'calculate-size';
but there is no exported module of such. How do I use this exactly? Size does not work either.

Result does not change on resize

I have some text with variable size ( font-size: clamp() )
I added a resize event listener that calls calculateSize
It seems to return the same result even if the text size changes

Thank you, great tool 👍

Miscomputation of width

Hi,

When using your library with following options, I got a miscomputation of the width:

font: 'Helvetica';
fontSize: '14px';
fontWeight: '400'

For example, Lalande de Pomerol and Bordeaux Supérieur get the same width (125px), while they shouldn't have.

The fix could be to use getBoundingClientRect().width instead of offsetWidth() in the computation (same for height).

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.