Skip to content

Not fitting, only uses max font size #48

Open
@douglasg14b

Description

@douglasg14b

I'm using this inside of a vue directive to try and fix text to it's container, however it does not seem to actually do anything except set the font size to the max I allow.

Watching the fit event shows no change even when I manually trigger the fit() function on the element.

The relevant markup looks like:

<div> <!-- div1 max-width = 150px -->
  <div> <!-- div2 no styling -->
    <span>Some long text goes here</span> <!-- The element that is fitty() -->
  </div>
</div>

The span that I am using fitty() on it larger than div 2 since the text causes it to overflow, which seems to be what fitty expects?

Other Info:

  • The text element is not forced to be the same size as the parent
  • The parent has no padding
  • Even when changing the text, the font-size is never changed by fitty when it triggers fit from the dom change
  • If I manually constrain the parent container by setting it's max-width, and then calling fit(), it still does not change the text's size to anything but the max

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions