1.0.1 • Published 10 months ago

areamap-design v1.0.1

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
10 months ago

Areamap design

The areamap design library provides a set of tools and components for integrating interactive area plan design into Angular applications.

node status

Stackblitz Example

https://stackblitz.com/edit/areamap-design

Output Screenshot

output

Basic Usage - Local Files

<nh-areamap-design 
  [enableZoom]="true"
  [readOnly]="true"
  [borderColor]="'red'" 
  [selectedPinColor]="'yellow'" 
  [defaultPinColor]="'red'"
  [viewCords]="true"
  [enablePinTooltip]="true"
  [defaultAreaPlan]="'./assets/white-background-500x500.jpg'"
  [areaPlan]="'assets/F43.pdf'"
  [pins]="pinlist"
  (pinChanged)="onpinSelected($event)"
  (createdPin)="onPinCreated($event)"
  ></nh-areamap-design>

Overview

Install

Angular >= 10

npm install areamap-design

Partial Ivy compilated library bundles.

Usage

Add AreamapDesignModule to your module's imports

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

import { AreamapDesignModule} from 'areamap-design';

@NgModule({
  imports: [BrowserModule, AreamapDesignModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})

class AppModule {}

platformBrowserDynamic().bootstrapModule(AppModule);

And then use it in your component

import { Component } from '@angular/core';

@Component({
  selector: 'app-base',
  template: `
  <nh-areamap-design 
  [enableZoom]="true"
  [readOnly]="true"
  [borderColor]="'red'" 
  [selectedPinColor]="'yellow'" 
  [defaultPinColor]="'red'"
  [viewCords]="true"
  [enablePinTooltip]="true"
  [defaultAreaPlan]="areaplan"
  [areaPlan]="'assets/F43.pdf'"
  [pins]="pinlist"
  (pinChanged)="onpinSelected($event)"
  (createdPin)="onPinCreated($event)"
  ></nh-areamap-design>`
})
export class AppComponent {
  areaplan= "http://www.worldplumbing.org/wp-content/uploads/2016/11/white-background-500x500.jpg";
  pinlist = [{location: {x: 200, y: 200}, color: 'pink', name: 'Pin 1'}];

  onpinSelected(args) {
    console.log(args, 'pin selected')
  }

  onPinCreated(args) {
    console.log(args, 'pin created')
  }
}

Options

enableZoom

PropertyTypeRequired
enableZoombooleanRequired

Allow zoom areamap

[enableZoom]="true"

readOnly

PropertyTypeRequired
readOnlybooleanOptional, default = false

Readonly areamap if user don't want any integration with in

[readOnly]="true"

borderColor

PropertyTypeRequired
borderColorstringRequired

Border color for the pin on areamap

[borderColor]="'red'"

selectedPinColor

PropertyTypeRequired
selectedPinColorstringRequired

User selected pin color for the pin on areamap

[selectedPinColor]="'yellow'"

defaultPinColor

PropertyTypeRequired
selectedPinColorstringRequired

User default pin color for the pin on areamap

[defaultPinColor]="'gray'"

viewCords

PropertyTypeRequired
viewCordsbooleanRequired

Enable to View X and Y coordinate of areamap

[viewCords]="true"

enablePinTooltip

PropertyTypeRequired
enablePinTooltipbooleanRequired

Enable hover tooltip of pin

[enablePinTooltip]="true"

defaultAreaPlan

PropertyTypeRequired
defaultAreaPlanstringRequired

Pass areamap default plan

[defaultAreaPlan]="'./assets/map-default.pdf'"

areaPlan

PropertyTypeRequired
areaPlanstringRequired

Actual areamap plan

[areaPlan]="'./assets/map-23.pdf'"

pins

PropertyTypeRequired
pinsArrayOptional

List of pins that user want to plot on areaplan

pinList = [
     {  location: 
         { x: 200, y: 200}, 
         color: 'pink',  
         name: 'Pin 1'
     }
  ];

(pinChanged)

PropertyTypeRequired
(pinChanged)callbackOptional

Selected pin changed handling callback

Define callback in your component's class

onPinSelected(args: any) {
  // do anything
}

Then add it to nh-areamap-design in component's template

(error)="onPinSelected($event)"

(createdPin)

PropertyTypeRequired
(createdPin)callbackOptional

New pin created handling callback

Define callback in your component's class

onPinCreated(args: any) {
  // do anything
}

Then add it to nh-areamap-design in component's template

(createdPin)="onPinCreated($event)"

License

MIT © Narendra Hinge