npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

vue-image-marker-2

v1.1.6

Published

Image container for adding icon marker to the image. (dynamically! πŸ˜ƒ)

Downloads

28

Readme

vue-image-marker 2

Image container for adding icon marker to the image. (dynamically! πŸ˜ƒ)

New Features πŸ˜ƒ

This project is based in https://github.com/jarvisniu/vue-image-marker by jarvisniu, i added some features like:

  • New component for adding dynamically markers inside the image.
  • 3 modes for
    • 0 None, this mode is only for previewing your image with marks.
    • 1 Set marker, you can set markers by clicking the map.
    • 2 Delete marker, you can delete a marker by clicking it.
  • We can create a marker with info a then retrieve it when click

npm

https://www.npmjs.com/package/vue-image-marker-2

Demo

  • New demo for vue image maker 2

Demo

Usage

Install:

npm i vue-image-marker-2

Import:

import Vue from 'vue'
import vImageMarker2 from 'vue-image-marker-2'
Vue.use(vImageMarker2)

Use:

  <div>
    <h3>Vue Image Marker Demo 2.0</h3>
    <button @click="padding += 10">+</button>
    <button @click="padding -= 10">-</button>
    <select name="" id="" v-model="mode">
      <option v-for="mode in modes" :key="mode.value" :value="mode.value">
        {{ mode.text }}
      </option>
    </select>
    <v-image-marker
      :mode="mode"
      @setMarker="getMark"
      class="image-marker"
      :src="urlImage"
      :padding="padding"
    >
      <v-marker
        :mode="mode"
        @click="markerClicked"
        v-for="(marker, index) in markers"
        :key="index"
        :x="marker.x"
        :y="marker.y"
        :color="marker.color"
        :id="marker.id"
      ></v-marker>
    </v-image-marker>
  </div>
import urlImage from "./map.png";

function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
  .toString(16)
  .substring(1);
}

export function guid() {
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
}

export default {
data() {
  return {
    //Mode 1: Set Marker
    //Mode 2: Delete marker
    //Mode 0: None of them
    mode: 1,
    modes: [
      { value: 0, text: "None" },
      { value: 1, text: "Set Marker" },
      { value: 2, text: "Delete Marker" },
    ],
    urlImage: urlImage,
    padding: 20,
    markers: [],
  };
},
methods: {
  markerClicked(id) {
    var index = this.markers.findIndex(function (marker) {
      return marker.id == id;
    });
    if (index !== -1) {
      this.markers.splice(index, 1);
    }
  },
  getMark(data) {
    this.markers.push({ color: "red", id: guid(), ...data });
  },
},
};
.image-marker
  width calc(100vw - 20px)
  height calc(100vh - 100px)
  border solid 1px silver
  user-select none
  background-color #f8f8f8

API

VueMarkerImage Props

  • src: Url of the image where the markers overlaid on.
  • padding: Container padding, default is 0.
  • mode: Image marker's mode, the definition of each mode is
    • 0 None, this mode is only for previewing your image with marks.
    • 1 Set marker, you can set markers by clicking the map.
    • 2 Delete marker, you can delete a marker by clicking it.

VueMarker Props

  • color: Marker's color.
  • info: Info that you can attach to the marker.
  • x: Marker's location in x axis.
  • y: Marker's location in y axis.
  • id: Unique id for the marker
  • mode: Image marker's mode, the definition of each mode is
    • 0 None, this mode is only for previewing your image with marks.
    • 1 Set marker, you can set markers by clicking the map.
    • 2 Delete marker, you can delete a marker by clicking it.

License

MIT