Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

labelgun

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

labelgun - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

docs/documentation/module-labelgun.html

45

lib/labelgun.js

@@ -171,3 +171,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

* @name getLabelsByState
* @summary provided a state get all labels of that state
* @summary Provided a state get all labels of that state
* @returns {array}

@@ -258,4 +258,4 @@ * @private

/**
* @name updateLabelStates
* @summary Allows you to set a state for all current labels
* @name callLabelCallbacks
* @summary Perform the related callback for a label depending on where its state is 'show' or 'hide'
* @param {string} [forceState] the class of which to change the label to

@@ -266,8 +266,8 @@ * @returns {undefined}

}, {
key: "updateLabelStates",
value: function updateLabelStates(forceState) {
key: "callLabelCallbacks",
value: function callLabelCallbacks(forceState) {
var _this = this;
this.tree.all().forEach(function (label) {
_this._labelHasChangedState(label, forceState);
_this._callLabelStateCallback(label, forceState);
});

@@ -277,6 +277,6 @@ }

/**
* @name _labelHasChangedState
* @summary Sets the class for a particular label
* @name _callLabelStateCallback
* @summary Calls the correct callback for a particular label depending on its state (hidden or shown)
* @param {string} label the label to update
* @param {string} forceState the class of which to change the label to
* @param {string} forceState the state of which to change the label to ('show' or 'hide')
* @returns {undefined}

@@ -287,4 +287,4 @@ * @private

}, {
key: "_labelHasChangedState",
value: function _labelHasChangedState(label, forceState) {
key: "_callLabelStateCallback",
value: function _callLabelStateCallback(label, forceState) {
var state = forceState || label.state;

@@ -297,3 +297,3 @@ if (state === "show") this.showLabel(label);

* @name setupLabelStates
* @summary Setups the labels depending on whether all have changed or some have changed
* @summary Sets up the labels depending on whether all have changed or some have changed
* @returns {undefined}

@@ -348,16 +348,17 @@ */

this.setupLabelStates();
this.handlePreviousCollisions();
this._handlePreviousCollisions();
this._hideShownCollisions(); // TODO: why is this necessary ? :(
this.updateLabelStates();
this.callLabelCallbacks();
}
/**
* @name handlePreviousCollisions
* @name _handlePreviousCollisions
* @summary Checks to see if a previously hidden/collided label is now able to be shown and then changes there state
* @returns {undefined}
* @private
*/
}, {
key: "handlePreviousCollisions",
value: function handlePreviousCollisions() {
key: "_handlePreviousCollisions",
value: function _handlePreviousCollisions() {
var _this3 = this;

@@ -437,4 +438,4 @@

}, {
key: "removeFromTree",
value: function removeFromTree(label, forceUpdate) {
key: "_removeFromTree",
value: function _removeFromTree(label, forceUpdate) {
var id = label.id || label;

@@ -444,3 +445,3 @@ var removelLabel = this.allLabels[id];

delete this.allLabels[id];
if (forceUpdate) this.updateLabelStates(true);
if (forceUpdate) this.callLabelCallbacks(true);
}

@@ -482,3 +483,3 @@

* @param {boolean} isDragged if label is currently being dragged
* @summary Weighted collisions resolution for labels
* @summary Weighted collisions resolution for labels in the tree
* @returns {undefined}

@@ -536,3 +537,3 @@ * @private

var oldLabel = this.allLabels[id];
if (oldLabel) this.removeFromTree(oldLabel);
if (oldLabel) this._removeFromTree(oldLabel);

@@ -539,0 +540,0 @@ // Add the new label to the tree

{
"name": "labelgun",
"version": "3.0.0",
"version": "4.0.0",
"description": "A mapping library agnostic labelling engine",

@@ -14,4 +14,4 @@ "main": "lib/labelgun.js",

"build-both": "webpack && webpack --env.minified",
"doc": "jsdoc src/labelgun.js --destination doc/documentation",
"doc-deploy": "npm run doc && git push origin --delete gh-pages && git subtree push --prefix docs/ origin gh-pages"
"doc": "jsdoc src/labelgun.js --destination docs/documentation",
"doc-deploy": "npm run doc && git add docs && git commit -m 'Updated docs' && git push origin --delete gh-pages && git subtree push --prefix docs/ origin gh-pages"
},

@@ -18,0 +18,0 @@ "author": "James Milner <james.milner@geovation.uk> (http://geovation.uk/)",

@@ -23,10 +23,15 @@ ![labelgun](logo.png)

Or if you're using `yarn`:
`yarn add labelgun`
You can also use a auto-generated CDN thanks to unpkg :
`https://unpkg.com/labelgun@2.0.0/lib/labelgun.js`
`https://unpkg.com/labelgun@3.0.0/lib/labelgun.js`
### Docs and Demos
### Demo
Check out the [docs and demos live here](http://tech.geovation.uk/labelgun/)
A nice interactive way to play with the demos is to use a hot reloading web server such as live-server:
A nice interactive way to play with the demos locally is to use a hot reloading web server such as live-server:

@@ -33,0 +38,0 @@ `npm install -g live-server`

@@ -69,3 +69,3 @@ /**

* @name getLabelsByState
* @summary provided a state get all labels of that state
* @summary Provided a state get all labels of that state
* @returns {array}

@@ -138,10 +138,10 @@ * @private

/**
* @name updateLabelStates
* @summary Allows you to set a state for all current labels
* @name callLabelCallbacks
* @summary Perform the related callback for a label depending on where its state is 'show' or 'hide'
* @param {string} [forceState] the class of which to change the label to
* @returns {undefined}
*/
updateLabelStates(forceState) {
callLabelCallbacks(forceState) {
this.tree.all().forEach(label => {
this._labelHasChangedState(label, forceState);
this._callLabelStateCallback(label, forceState);
});

@@ -151,10 +151,10 @@ }

/**
* @name _labelHasChangedState
* @summary Sets the class for a particular label
* @name _callLabelStateCallback
* @summary Calls the correct callback for a particular label depending on its state (hidden or shown)
* @param {string} label the label to update
* @param {string} forceState the class of which to change the label to
* @param {string} forceState the state of which to change the label to ('show' or 'hide')
* @returns {undefined}
* @private
*/
_labelHasChangedState(label, forceState) {
_callLabelStateCallback(label, forceState) {
const state = forceState || label.state;

@@ -167,3 +167,3 @@ if (state === "show") this.showLabel(label);

* @name setupLabelStates
* @summary Setups the labels depending on whether all have changed or some have changed
* @summary Sets up the labels depending on whether all have changed or some have changed
* @returns {undefined}

@@ -231,5 +231,5 @@ */

this.setupLabelStates();
this.handlePreviousCollisions();
this._handlePreviousCollisions();
this._hideShownCollisions(); // TODO: why is this necessary ? :(
this.updateLabelStates();
this.callLabelCallbacks();

@@ -239,7 +239,8 @@ }

/**
* @name handlePreviousCollisions
* @name _handlePreviousCollisions
* @summary Checks to see if a previously hidden/collided label is now able to be shown and then changes there state
* @returns {undefined}
* @private
*/
handlePreviousCollisions() {
_handlePreviousCollisions() {
this.getHidden().forEach(hidden => {

@@ -310,3 +311,3 @@ if (hidden.state === "hide") {

*/
removeFromTree(label, forceUpdate) {
_removeFromTree(label, forceUpdate) {
const id = label.id || label;

@@ -316,3 +317,3 @@ const removelLabel = this.allLabels[id];

delete this.allLabels[id];
if (forceUpdate) this.updateLabelStates(true);
if (forceUpdate) this.callLabelCallbacks(true);
}

@@ -348,3 +349,3 @@

* @param {boolean} isDragged if label is currently being dragged
* @summary Weighted collisions resolution for labels
* @summary Weighted collisions resolution for labels in the tree
* @returns {undefined}

@@ -397,3 +398,3 @@ * @private

const oldLabel = this.allLabels[id];
if (oldLabel) this.removeFromTree(oldLabel);
if (oldLabel) this._removeFromTree(oldLabel);

@@ -400,0 +401,0 @@ // Add the new label to the tree

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc