nativescript-community / nativescript-community/ui-canvas

Nothing gets drawn when using Path

Open
#54 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
38
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Which platform(s) does your issue occur on?
  • affected os: iOS (maybe android?)
  • version: iOS 17.4
  • emulator or device: Simulator
Please, provide the following version numbers that your issue occurs with:
  • CLI: 8.7.0
  • Cross-platform modules: 8.6.2
  • Runtime(s): ios: 8.6.4
  • Plugin(s): ui-canvas 4.7.16, ui-chart 2.0.1
Please, tell us how to recreate the issue in as much detail as possible.

I am trying to create a rectangle for ui-chart. Where top left and top right corners are rounded.
I found a solution on stackoverflow https://stackoverflow.com/questions/5896234/how-to-use-android-canvas-to-draw-a-rectangle-with-only-topleft-and-topright-cor
The problem i am facing it just doesnt draw anything. When drawing a normal rectangle or when drawing a rounded rectangle everything looks fine. But with the path solution as suggestion on so nothing gets drawn

Is there any code involved?
chart.customRenderer = {
  drawBar(c, e, dataSet, left, top, right, bottom, paint) {
    let delta = 0;
    if (!e.last) {
      delta+=9;
    }
    const path = new Path();
    const corners = [
      5, 5,        // Top left radius in px
      5, 5,        // Top right radius in px
      0, 0,          // Bottom right radius in px
      0, 0           // Bottom left radius in px
    ]
    const rec = createRect(left+delta, 100-(bottom-top), 9, bottom-top);
    path.addRoundRect(rec, corners, Direction.CW)
    c.drawPath(path, paint);
  }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the customRenderer.drawBar entry point and inspect the Path construction and c.drawPath call on iOS 17.4 with ui-canvas 4.7.16. Compare this case with the working normal and fully rounded rectangle cases; done means the bar with only its top corners rounded is visible in the supplied ui-chart scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, javascript
Domain
computer-graphics, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.