Giter Site home page Giter Site logo

Nothing drawn on canvas about canvas HOT 18 CLOSED

nativescript avatar nativescript commented on May 19, 2024
Nothing drawn on canvas

from canvas.

Comments (18)

triniwiz avatar triniwiz commented on May 19, 2024 1

You can fund it through github sponsors or opencollective

from canvas.

OzymandiasTheGreat avatar OzymandiasTheGreat commented on May 19, 2024 1

Real device running android 10. My machine doesn't handle the emulator well.

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

Can you try wrapping the draw call in a setTimeout on android ? 🤔

from canvas.

Mwni avatar Mwni commented on May 19, 2024

I did, to no avail

from canvas.

Mwni avatar Mwni commented on May 19, 2024

Do I need to somehow install the native code for android? I ran ns plugin add @nativescript/canvas to install, sufficient?

from canvas.

Mwni avatar Mwni commented on May 19, 2024

For iOS I sadly cannot test it because:
None of your spec sources contain a spec satisfying the dependency: CanvasNative (~> 0.9.19)
Do I need to compile the pod myself?

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

@Mwni fixed iOS there was plans to release a new pod but sadly I did not so the package had the wrong version update to 0.9.21 as for android I will fix also can you try webgl an lmk if it draws

let gl;
let canvas;
export function canvasReady(args) {
	console.log('canvas ready');
	canvas = args.object;
	gl = canvas.getContext('webgl'); // 'webgl' || 'webgl2'
	gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
	// Set the clear color to darkish green.
	gl.clearColor(0.0, 0.5, 0.0, 1.0);
	// Clear the context with the newly set color. This is
	// the function call that actually does the drawing.
	gl.clear(gl.COLOR_BUFFER_BIT);
}

from canvas.

Mwni avatar Mwni commented on May 19, 2024

The pod version 0.9.21 was not available, but 0.9.18 was, so the install worked, and the canvas did draw on iOS. Just as well did the WebGL context on android. So this could come down to some niche bug regarding my specific environment (Windows 7 Android emulator). triniwiz, thank you for looking into this. At this point I am perfectly able to continue developing my app.

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

Okay so the gl context drew fine on both platforms ? Then it would be on my end to fix for android also that package version is the npm package not a pod

from canvas.

Mwni avatar Mwni commented on May 19, 2024

Yes, gl worked fine. For 2d context on android, I have not tested it on an actual android device, I will let you know once I have, but I'm assuming it will work there. On a tangent, I did not find where I can specifically fund this development, would it be through the OpenJS foundation?

from canvas.

JacobFJ avatar JacobFJ commented on May 19, 2024

@triniwiz For android it working 2d but the canvas is broken layout it look like I draw a circle the result is cicle with broken it look like house tiles

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

@HakobiDev can you share a screenshot please

from canvas.

OzymandiasTheGreat avatar OzymandiasTheGreat commented on May 19, 2024

Re: rendering broken on Android. Here's the screenshot
Screenshot_20210616-052337_canvasbug

And here's the code behind that view

onReady(event: any): void {
    const canvas: Canvas = event.object;
    const ctx = <CanvasRenderingContext2D> canvas.getContext('2d');
    ctx.beginPath();
    ctx.moveTo(75, 50);
    ctx.lineTo(100, 75);
    ctx.lineTo(100, 25);
    ctx.scale(0.3, 0.5);
    ctx.fill();
  }

The white part is normally noise, but I have a non-attached canvas with a white background created as well and it somehow crosses over into the displayed canvas.

Sorry, if I should've opened a new issue, it's just that the last comment is describing this exact issue I think.

Oh and also, nativescript is version 8.0.2. Everything's as up to date as possible.

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

Can you try updating to the latest alpha tag , also I added a new property to help with scaling ignorePixelScaling="true" you can also try it

from canvas.

JacobFJ avatar JacobFJ commented on May 19, 2024

@triniwiz thanks! I will also check it out.

from canvas.

OzymandiasTheGreat avatar OzymandiasTheGreat commented on May 19, 2024

Just tried the latest alpha. The rendering is still broken. Noise is now replaced by black squares and it still tiles for some reason rather than displaying drawn image normally.

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

@OzymandiasTheGreat real device or emulator ?

from canvas.

triniwiz avatar triniwiz commented on May 19, 2024

Please try with the latest , reopen if the issue still persists

from canvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.