Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
ng2-konva is a JavaScript library for drawing complex canvas graphics using Angular.
It provides declarative and reactive bindings to the Konva Framework.
All ng2-konva
components correspond to Konva
components of the same name with the prefix 'ko-'. All the parameters available for Konva
objects can add as config
in the prop as Observable for corresponding ng2-konva
components.
Core shapes are: ko-stage, ko-layer, ko-rect, ko-circle, ko-ellipse, ko-line, ko-image, ko-text, ko-text-path, ko-star, ko-label, SVG Path, ko-regular-polygon. Also you can create custom shape.
To get more info about Konva
you can read Konva Overview.
http://rafaelescala.com/ng2-konva/
To install this library, run:
$ npm install konva ng2-konva --save
and then from your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import KonvaModule
import { KonvaModule } from 'ng2-konva';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
KonvaModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Once KonvaModule
is imported, you can use its components in your Angular application:
import { of } from 'rxjs/Observable';
@Component({
selector: 'app',
template: `
<ko-stage [config]="configStage">
<ko-layer>
<ko-circle [config]="configCircle" (click)="handleClick($event)"></ko-circle>
</ko-layer>
</ko-stage>`
})
class AppComponent implements OnInit {
public configStage: Observable<any> = of({
width: 200,
height: 200
});
public configCircle: Observable<any> = of({
x: 100,
y: 100,
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4
});
public handleClick(component) {
console.log('Hello Circle', component);
}
}
MIT © Rafael Escala
FAQs
Angular binding to canvas element via Konva framework
We found that ng2-konva demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.