Fix rects view (weird triangular shapes)
Rectangles with property cornerRadius === 0 could result in weird triangular shapes being drawn instead of rectangles Fix: b/264541479 Test: follow steps in b/264541479 and check issue is gone Change-Id: I2421e47cdbf7c932218640f2553647ded676a80d
This commit is contained in:
@@ -253,7 +253,12 @@ export class Canvas {
|
||||
const height = rect.bottomRight.y - rect.topLeft.y;
|
||||
const width = rect.bottomRight.x - rect.topLeft.x;
|
||||
const minEdge = Math.min(height, width);
|
||||
const cornerRadius = Math.min(rect.cornerRadius, minEdge / 2);
|
||||
let cornerRadius = Math.min(rect.cornerRadius, minEdge / 2);
|
||||
|
||||
// Force radius > 0, because radius === 0 could result in weird triangular shapes
|
||||
// being drawn instead of rectangles. Seems like quadraticCurveTo() doesn't
|
||||
// always handle properly the case with radius === 0.
|
||||
cornerRadius = Math.max(cornerRadius, 0.01);
|
||||
|
||||
// Create (rounded) rect shape
|
||||
return new THREE.Shape()
|
||||
|
||||
Reference in New Issue
Block a user