Skip to content

Path2D.roundedRect crash on iOS 15.4 #86

@darkyelox

Description

@darkyelox

Tested on simulator with:
@nativescript/core: 8.3.2
@nativescript/ios: 8.3.2

There is a weird behavior with the roundedRect on iOS:

const checkboxPath = new Path2D()

checkboxPath.roundedRect(0,0, 50, 50, 1) // this draw a weird shape if I draw something else over it

// checkboxPath.roundedRect(0,0, 50, 50, 10) <--- this crash the app

canvasContext.fill(checkboxPath)

I tried to create my own roundedRect function with the next code but it also crashes the app:

  if (width < 2 * radius) radius = width / 2;
  if (height < 2 * radius) radius = height / 2;
  context.beginPath();
  context.moveTo(x+radius, y);
  context.arc(x+width, y,   x + width, y + height, radius);
  context.arcTo(x+width, y+height, x,   y+height, radius);
  context.arcTo(x,   y+height, x,   y,   radius);
  context.arcTo(x,   y,   x+width, y,   radius);
  context.closePath();

I was trying to animate a rounded rect increasing on a custom checkbox for a checked state and drawing the check mark over it also animated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions