Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
How to change width\height of fabric.Path object? Params width\height in constructor don't work

I use fabric-js and try to pass width and height of fabric.Path via params in constructor like so:

const path = 'M16.2777 24.96C15.4876 26.3467 13.5124 26.3467 12.7223 24.96L0.27808 3.12C-0.512027 1.73333 0.475607 0 2.05582 0H26.9442C28.5244 0 29.512 1.73333 28.7219 3.12L16.2777 24.96Z';

const mapObject = new fabric.Path(path , {
  width: 30, //
  height: 30, //
  left: 100,
  top: 100,
  fill: '#c9c9c9',      
});

It works fine, but I can't affect to "image size". I pass different values but nothing changes.

Where am I wrong and how can I set size of fabric.Path object?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Path objects can be resized by changing the scaleX and scaleY values.

To achieve a specific width or height, you can also use the scaleToWidth() and scaleToHeight() methods.

http://fabricjs.com/docs/fabric.Path.html#scaleToHeight http://fabricjs.com/docs/fabric.Path.html#scaleToWidth

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!