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

leaflet-editable-textbox

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-editable-textbox - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

71

dist/L.Editable.Textbox-src.js

@@ -388,3 +388,6 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g=(g.L||(g.L = {}));g=(g.Editable||(g.Editable = {}));g.Textbox = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

_updateTextAreaBounds: function() {
var scale, latlngs, pos, size;
var scale;
var pos;
var size;
var center;
var feature = this.feature;

@@ -394,2 +397,3 @@ var bounds = feature._bounds;

var map = this.map;
var bounds;

@@ -399,10 +403,14 @@ if (null !== textArea) {

scale = feature._getScale(map.getZoom());
latlngs = feature._boundsToLatLngs(bounds);
pos = map.latLngToLayerPoint(latlngs[1]);
size = map.latLngToLayerPoint(latlngs[3]).subtract(pos);
bounds = feature.getBounds();
center = map.latLngToLayerPoint(bounds.getCenter());
pos = map.latLngToLayerPoint(bounds.getNorthWest());
size = L.point(2 * Math.abs(center.x - pos.x),
2 * Math.abs(center.y - pos.y))
.divideBy(scale)
.round();
L.DomUtil
.setSize(textArea, size.divideBy(scale).round())
.setSize(textArea, size)
.setTransform(textArea, pos, scale.toFixed(3));
textArea.style.display = '';
textArea.style.display = '';
textArea.style.position = 'absolute';

@@ -484,2 +492,3 @@ textArea.setAttribute('spellcheck', false);

var textSize;
var fontSizeAttr;

@@ -489,11 +498,13 @@ if (0 < texts.length) {

for (var ind = texts.length - 1; 0 <= ind; --ind) {
textSize = parseFloat(texts[ind].getAttribute('font-size'));
size += textSize;
if (sizeMin > textSize) {
sizeMin = textSize;
fontSizeAttr = texts[ind].getAttribute('font-size');
if (null !== fontSizeAttr) {
textSize = parseFloat(texts[ind].getAttribute('font-size'));
size += textSize;
if (sizeMin > textSize) {
sizeMin = textSize;
}
if (sizeMax < textSize) {
sizeMax = textSize;
}
}
if (sizeMax < textSize) {
sizeMax = textSize;
}
}

@@ -531,5 +542,7 @@

var scale = layer._getScale(this._map.getZoom());
var pos = layer._rings[0][1];
var size = layer._rings[0][3].subtract(pos).divideBy(scale);
var bounds = layer.getBounds();
var center = layer._map.latLngToLayerPoint(bounds.getCenter());
var pos = layer._map.latLngToLayerPoint(bounds.getNorthWest());
var size = L.point(2 * Math.abs(center.x - pos.x),
2 * Math.abs(center.y - pos.y)).divideBy(scale);
var chars = text.split('');

@@ -652,2 +665,17 @@ var line = chars.shift();

/**
* @param {L.Map} map
*/
onRemove: function(map) {
if (null !== this._textNode) {
if (null !== this._textNode.parentNode) {
this._textNode.parentNode.removeChild(this._textNode);
}
this._textNode = null;
}
L.Rectangle.prototype.onRemove.call(this, map);
},
_renderText: function() {

@@ -665,4 +693,5 @@ if (this._renderer) {

_updatePosition: function() {
if (null !== this._textNode && 0 !== this._rings.length) {
var pos = this._rings[0][1];
if (null !== this._textNode) {
var bounds = this.getBounds();
var pos = this._map.latLngToLayerPoint(bounds.getNorthWest());
var textMatrix = new L.Matrix(1, 0, 0, 1, 0, 0)

@@ -704,2 +733,2 @@ .translate(pos)

});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9u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AgIHRzcGFuLmZpcnN0Q2hpbGQubm9kZVZhbHVlID0gbGluZTtcbiAgICAgICAgICB2YXIgbGluZUxlbmd0aCA9IGxheWVyLm9wdGlvbnMucGFkZGluZyArXG4gICAgICAgICAgICB0c3Bhbi5nZXRDb21wdXRlZFRleHRMZW5ndGgoKTtcblxuICAgICAgICAgIGlmIChsaW5lTGVuZ3RoID4gbWF4V2lkdGggJiYgMSA8PSBsaW5lLmxlbmd0aCkge1xuICAgICAgICAgICAgKytsaW5lSW5kO1xuICAgICAgICAgICAgdHNwYW4uZmlyc3RDaGlsZC5ub2RlVmFsdWUgPSBwcmV2TGluZS5yZXBsYWNlKC9cXHMqJC9nbSwgJycpO1xuICAgICAgICAgICAgcHJldkxpbmUgPSAnJztcbiAgICAgICAgICAgIGxpbmUgPSBjaGFyO1xuICAgICAgICAgICAgdHNwYW4gPSB0aGlzLl90ZXh0TWFrZU5leHRMaW5lKHRleHRFbGVtZW50LCBsaW5lLCB7XG4gICAgICAgICAgICAgIHg6IGxheWVyLm9wdGlvbnMucGFkZGluZyxcbiAgICAgICAgICAgICAgZHk6IExJTkVfRkFDVE9SICogbGluZUhlaWdodFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNoYXIgPSBjaGFycy5zaGlmdCgpO1xuICAgICAgfVxuICAgIH0gZWxzZSBpZiAobnVsbCAhPT0gdGV4dEVsZW1lbnQpIHtcbiAgICAgIHRleHRFbGVtZW50LnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQodGV4dEVsZW1lbnQpO1xuICAgICAgdGV4dEVsZW1lbnQgPSBudWxsO1xuICAgIH1cblxuICAgIHJldHVybiB0ZXh0RWxlbWVudDtcbiAgfSxcblxuXG4gIF90ZXh0TWFrZU5leHRMaW5lOiBmdW5jdGlvbihjb250YWluZXIsIHRleHQsIGF0dHJzKSB7XG4gICAgdmFyIHRzcGFuID0gTC5TVkcuY3JlYXRlKCd0c3BhbicpO1xuICA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21wdXRlZFRleHRMZW5ndGgoKTtcblxuICAgICAgICAgIGlmIChsaW5lTGVuZ3RoID4gbWF4V2lkdGggJiYgMSA8PSBsaW5lLmxlbmd0aCkge1xuICAgICAgICAgICAgKytsaW5lSW5kO1xuICAgICAgICAgICAgdHNwYW4uZmlyc3RDaGlsZC5ub2RlVmFsdWUgPSBwcmV2TGluZS5yZXBsYWNlKC9cXHMqJC9nbSwgJycpO1xuICAgICAgICAgICAgcHJldkxpbmUgPSAnJztcbiAgICAgICAgICAgIGxpbmUgPSBjaGFyO1xuICAgICAgICAgICAgdHNwYW4gPSB0aGlzLl90ZXh0TWFrZU5leHRMaW5lKHRleHRFbGVtZW50LCBsaW5lLCB7XG4gICAgICAgICAgICAgIHg6IGxheWVyLm9wdGlvbnMucGFkZGluZyxcbiAgICAgICAgICAgICAgZHk6IExJTkVfRkFDVE9SICogbGluZUhlaWdodFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNoYXIgPSBjaGFycy5zaGlmdCgpO1xuICAgICAgfVxuICAgIH0gZWxzZSBpZiAobnVsbCAhPT0gdGV4dEVsZW1lbnQpIHtcbiAgICAgIHRleHRFbGVtZW50LnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQodGV4dEVsZW1lbnQpO1xuICAgICAgdGV4dEVsZW1lbnQgPSBudWxsO1xuICAgIH1cblxuICAgIHJldHVybiB0ZXh0RWxlbWVudDtcbiAgfSxcblxuXG4gIF90ZXh0TWFrZU5leHRMaW5lOiBmdW5jdGlvbihjb250YWluZXIsIHRleHQsIGF0dHJzKSB7XG4gICAgdmFyIHRzcGFuID0gTC5TVkcuY3JlYXRlKCd0c3BhbicpO1xuICAgIHZhciBrZXk7XG5cbiAgICBmb3IgKGtleSBpbiBhdHRycyB8fCB7fSkge1xuICAgICAgaWYgKGF0dHJzLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgdHNwYW4uc2V0QXR0cmlidXRlKGtle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BhdGguY2FsbCh0aGlzKTtcbiAgICB0aGlzLl91cGRhdGVQb3NpdGlvbigpO1xuICB9XG5cbn0pO1xuIiwiLyoqXG4gKiBAcGFyYW0gIHtFbGVtZW50fSBlbGVtZW50XG4gKiBAcGFyYW0gIHtMLlBvaW50fSBzaXplXG4gKiBAcmV0dXJuIHtPYmplY3R9IHNlbGZcbiAqL1xuTC5Eb21VdGlsLnNldFNpemUgPSAgTC5Eb21VdGlsLnNldFNpemUgfHwgZnVuY3Rpb24oZWxlbWVudCwgc2l6ZSkge1xuICBlbGVtZW50LnN0eWxlLndpZHRoID0gc2l6ZS54ICArICdweCc7XG4gIGVsZW1lbnQuc3R5bGUuaGVpZ2h0ID0gc2l6ZS55ICsgJ3B4JztcbiAgcmV0dXJuIHRoaXM7XG59O1xuIl19

@@ -7,3 +7,3 @@ (function(t){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=t()}else if(typeof define==="function"&&define.amd){define([],t)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e=e.L||(e.L={});e=e.Editable||(e.Editable={});e.Textbox=t()}})(function(){var t,e,i;return function n(t,e,i){function r(o,s){if(!e[o]){if(!t[o]){var l=typeof require=="function"&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var f=e[o]={exports:{}};t[o][0].call(f.exports,function(e){var i=t[o][1][e];return r(i?i:e)},f,f.exports,n,t,e,i)}return e[o].exports}var a=typeof require=="function"&&require;for(var o=0;o<i.length;o++)r(i[o]);return r}({1:[function(t,e,i){var n=t("leaflet");t("leaflet-editable");t("leaflet-path-transform/src/Matrix");t("./src/Textbox");t("./src/Util");t("./src/Editable.Textbox");t("./src/SVG");e.exports=n.Editable.TextBoxEditor},{"./src/Editable.Textbox":3,"./src/SVG":4,"./src/Textbox":5,"./src/Util":6,leaflet:undefined,"leaflet-editable":undefined,"leaflet-path-transform/src/Matrix":2}],2:[function(t,e,i){L.Matrix=function(t,e,i,n,r,a){this._matrix=[t,e,i,n,r,a]};L.Matrix.prototype={transform:function(t){return this._transform(t.clone())},_transform:function(t){var e=this._matrix;var i=t.x,n=t.y;t.x=e[0]*i+e[1]*n+e[4];t.y=e[2]*i+e[3]*n+e[5];return t},untransform:function(t){var e=this._matrix;return new L.Point((t.x/e[0]-e[4])/e[0],(t.y/e[2]-e[5])/e[2])},clone:function(){var t=this._matrix;return new L.Matrix(t[0],t[1],t[2],t[3],t[4],t[5])},translate:function(t){if(t===undefined){return new L.Point(this._matrix[4],this._matrix[5])}var e,i;if(typeof t==="number"){e=i=t}else{e=t.x;i=t.y}return this._add(1,0,0,1,e,i)},scale:function(t,e){if(t===undefined){return new L.Point(this._matrix[0],this._matrix[3])}var i,n;e=e||L.point(0,0);if(typeof t==="number"){i=n=t}else{i=t.x;n=t.y}return this._add(i,0,0,n,e.x,e.y)._add(1,0,0,1,-e.x,-e.y)},rotate:function(t,e){var i=Math.cos(t);var n=Math.sin(t);e=e||new L.Point(0,0);return this._add(i,n,-n,i,e.x,e.y)._add(1,0,0,1,-e.x,-e.y)},flip:function(){this._matrix[1]*=-1;this._matrix[2]*=-1;return this},_add:function(t,e,i,n,r,a){var o=[[],[],[]];var s=this._matrix;var l=[[s[0],s[2],s[4]],[s[1],s[3],s[5]],[0,0,1]];var d=[[t,i,r],[e,n,a],[0,0,1]],f;if(t&&t instanceof L.Matrix){s=t._matrix;d=[[s[0],s[2],s[4]],[s[1],s[3],s[5]],[0,0,1]]}for(var u=0;u<3;u++){for(var h=0;h<3;h++){f=0;for(var x=0;x<3;x++){f+=l[u][x]*d[x][h]}o[u][h]=f}}this._matrix=[o[0][0],o[1][0],o[0][1],o[1][1],o[0][2],o[1][2]];return this}};L.matrix=function(t,e,i,n,r,a){return new L.Matrix(t,e,i,n,r,a)}},{}],3:[function(t,e,i){/**

*/
L.Editable.TextBoxEditor=L.Editable.RectangleEditor.extend({options:{textareaPadding:1},initialize:function(t,e,i){this._textArea=null;this._text=null;L.Editable.RectangleEditor.prototype.initialize.call(this,t,e,i)},updateStyle:function(){if(null!==this._textArea){var t=this._textArea.style;var e=this.feature.options;t.fontSize=e.fontSize+"px";t.color=e.fontColor;t.fontFamily=e.fontFamily}},enable:function(){L.Editable.RectangleEditor.prototype.enable.call(this);this.map.on("dragend",this._focus,this).on("zoomanim",this._animateZoom,this).on("zoomend",this._updateTextAreaBounds,this);if(null===this._textArea){this._textArea=L.DomUtil.create("textarea","leaflet-zoom-animated leaflet-textbox");var t=this._textArea.style;t.resize="none";t.border="none";t.padding=this.options.textareaPadding+"px";t.backgroundColor="transparent";t.overflow="hidden";this.updateStyle();this.map.getPane("markerPane").appendChild(this._textArea);this._text=this.feature._text;if(this._text){this._textArea.innerHTML=this._text}L.DomEvent.addListener(this._textArea,"keypress",L.DomEvent.stopPropagation);L.DomEvent.disableClickPropagation(this._textArea);this._updateTextAreaBounds()}if(this.feature._textNode){this.feature._textNode.parentNode.removeChild(this.feature._textNode);this.feature._textNode=null}return this},setText:function(t){this._text=t;if(null!==this._textArea){this._textArea.value=t}},getText:function(){if(this._enabled){this._text=this._textArea.value}return this._text},disable:function(){if(this._enabled){this.map.off("dragend",this._focus,this).off("zoomanim",this._animateZoom,this).off("zoomend",this._updateTextAreaBounds,this);if(null!==this._textArea){this.getText();L.DomEvent.removeListener(this._textArea,"keypress",L.DomEvent.stopPropagation);this._textArea.parentNode.removeChild(this._textArea);this._textArea=null}this.feature._text=this._text;if(this.map.hasLayer(this.feature)){this.feature._renderText()}}L.Editable.RectangleEditor.prototype.disable.call(this);return this},updateBounds:function(t){L.Editable.RectangleEditor.prototype.updateBounds.call(this,t);return this._updateTextAreaBounds()},_focus:function(){L.Util.requestAnimFrame(function(){if(null!==this._textArea){this._textArea.focus()}},this)},_animateZoom:function(t){var e=this.feature._bounds;var i=this.feature._getScale(t.zoom);var n=this.map._latLngToNewLayerPoint(e.getNorthWest(),t.zoom,t.center);L.DomUtil.setTransform(this._textArea,n,i.toFixed(3))},_updateTextAreaBounds:function(){var t,e,i,n;var r=this.feature;var a=r._bounds;var o=this._textArea;var s=this.map;if(null!==o){if(null!==a){t=r._getScale(s.getZoom());e=r._boundsToLatLngs(a);i=s.latLngToLayerPoint(e[1]);n=s.latLngToLayerPoint(e[3]).subtract(i);L.DomUtil.setSize(o,n.divideBy(t).round()).setTransform(o,i,t.toFixed(3));o.style.display="";o.style.position="absolute";o.setAttribute("spellcheck",false);this._focus()}else{o.style.display="none"}}return this}});L.TextBox.include({enableEdit:function(t){if(!this.editor){this.createEditor(t)}return L.Rectangle.prototype.enableEdit.call(this,t)},disableEdit:function(){if(this.editor){this._text=this.editor.getText()}L.Rectangle.prototype.disableEdit.call(this);return this},getEditorClass:function(){return L.Editable.TextBoxEditor}});L.Editable.prototype.startTextBox=function(t,e){return this.startRectangle(null,L.extend({rectangleClass:L.TextBox},e))}},{}],4:[function(t,e,i){/**
L.Editable.TextBoxEditor=L.Editable.RectangleEditor.extend({options:{textareaPadding:1},initialize:function(t,e,i){this._textArea=null;this._text=null;L.Editable.RectangleEditor.prototype.initialize.call(this,t,e,i)},updateStyle:function(){if(null!==this._textArea){var t=this._textArea.style;var e=this.feature.options;t.fontSize=e.fontSize+"px";t.color=e.fontColor;t.fontFamily=e.fontFamily}},enable:function(){L.Editable.RectangleEditor.prototype.enable.call(this);this.map.on("dragend",this._focus,this).on("zoomanim",this._animateZoom,this).on("zoomend",this._updateTextAreaBounds,this);if(null===this._textArea){this._textArea=L.DomUtil.create("textarea","leaflet-zoom-animated leaflet-textbox");var t=this._textArea.style;t.resize="none";t.border="none";t.padding=this.options.textareaPadding+"px";t.backgroundColor="transparent";t.overflow="hidden";this.updateStyle();this.map.getPane("markerPane").appendChild(this._textArea);this._text=this.feature._text;if(this._text){this._textArea.innerHTML=this._text}L.DomEvent.addListener(this._textArea,"keypress",L.DomEvent.stopPropagation);L.DomEvent.disableClickPropagation(this._textArea);this._updateTextAreaBounds()}if(this.feature._textNode){this.feature._textNode.parentNode.removeChild(this.feature._textNode);this.feature._textNode=null}return this},setText:function(t){this._text=t;if(null!==this._textArea){this._textArea.value=t}},getText:function(){if(this._enabled){this._text=this._textArea.value}return this._text},disable:function(){if(this._enabled){this.map.off("dragend",this._focus,this).off("zoomanim",this._animateZoom,this).off("zoomend",this._updateTextAreaBounds,this);if(null!==this._textArea){this.getText();L.DomEvent.removeListener(this._textArea,"keypress",L.DomEvent.stopPropagation);this._textArea.parentNode.removeChild(this._textArea);this._textArea=null}this.feature._text=this._text;if(this.map.hasLayer(this.feature)){this.feature._renderText()}}L.Editable.RectangleEditor.prototype.disable.call(this);return this},updateBounds:function(t){L.Editable.RectangleEditor.prototype.updateBounds.call(this,t);return this._updateTextAreaBounds()},_focus:function(){L.Util.requestAnimFrame(function(){if(null!==this._textArea){this._textArea.focus()}},this)},_animateZoom:function(t){var e=this.feature._bounds;var i=this.feature._getScale(t.zoom);var n=this.map._latLngToNewLayerPoint(e.getNorthWest(),t.zoom,t.center);L.DomUtil.setTransform(this._textArea,n,i.toFixed(3))},_updateTextAreaBounds:function(){var t;var e;var i;var n;var r=this.feature;var a=r._bounds;var o=this._textArea;var s=this.map;var a;if(null!==o){if(null!==a){t=r._getScale(s.getZoom());a=r.getBounds();n=s.latLngToLayerPoint(a.getCenter());e=s.latLngToLayerPoint(a.getNorthWest());i=L.point(2*Math.abs(n.x-e.x),2*Math.abs(n.y-e.y)).divideBy(t).round();L.DomUtil.setSize(o,i).setTransform(o,e,t.toFixed(3));o.style.display="";o.style.position="absolute";o.setAttribute("spellcheck",false);this._focus()}else{o.style.display="none"}}return this}});L.TextBox.include({enableEdit:function(t){if(!this.editor){this.createEditor(t)}return L.Rectangle.prototype.enableEdit.call(this,t)},disableEdit:function(){if(this.editor){this._text=this.editor.getText()}L.Rectangle.prototype.disableEdit.call(this);return this},getEditorClass:function(){return L.Editable.TextBoxEditor}});L.Editable.prototype.startTextBox=function(t,e){return this.startRectangle(null,L.extend({rectangleClass:L.TextBox},e))}},{}],4:[function(t,e,i){/**
* SVG tools

@@ -15,2 +15,2 @@ *

*/
var n=12;var r=1.12;L.SVG.calcFontSize=L.SVG.calcFontSize||function(t){var e=n;var i=Number.MAX_VALUE;var r=Number.MIN_VALUE;var a=t.querySelectorAll("text");var o;if(0<a.length){e=0;for(var s=a.length-1;0<=s;--s){o=parseFloat(a[s].getAttribute("font-size"));e+=o;if(i>o){i=o}if(r<o){r=o}}return{size:Math.round(e/a.length+.5),min:Math.round(i+.5),max:Number.MIN_VALUE===r?e:Math.round(r+.5)}}return{size:e,min:e,max:e}};L.SVG.include({renderText:function(t){var e=t._textNode;var i=t._text;if(e){e.parentNode.removeChild(e)}e=t._textNode=L.SVG.create("text");t.updateStyle();this._rootGroup.appendChild(e);if(i){var n=t._getScale(this._map.getZoom());var a=t._rings[0][1];var o=t._rings[0][3].subtract(a).divideBy(n);var s=i.split("");var l=s.shift();var d=s.shift();var f=1;var u=o.x-t.options.padding;var h=this._textMakeNextLine(e,l,{x:t.options.padding});var x=e.getBBox().height;h.setAttribute("dy",x);while(d){if(" "===d){l+=d}else if("\n"===d){l="";h=this._textMakeNextLine(e,l,{x:t.options.padding,dy:r*x})}else if(" "!==d){var p=l;l+=d;h.firstChild.nodeValue=l;var c=t.options.padding+h.getComputedTextLength();if(c>u&&1<=l.length){++f;h.firstChild.nodeValue=p.replace(/\s*$/gm,"");p="";l=d;h=this._textMakeNextLine(e,l,{x:t.options.padding,dy:r*x})}}d=s.shift()}}else if(null!==e){e.parentNode.removeChild(e);e=null}return e},_textMakeNextLine:function(t,e,i){var n=L.SVG.create("tspan");var r;for(r in i||{}){if(i.hasOwnProperty(r)){n.setAttribute(r,i[r])}}n.appendChild(document.createTextNode(e||""));t.appendChild(n);return n}})},{}],5:[function(t,e,i){L.TextBox=L.Rectangle.extend({options:{padding:2,fontSize:12,fillOpacity:.5,fillColor:"#ffffff",weight:1,fontColor:"",fontFamily:"",ratio:1,text:"Please, add text"},initialize:function(t,e){L.Rectangle.prototype.initialize.call(this,t,e);this._text=this.options.text;this._textNode=null},setStyle:function(t){L.setOptions(this,t);if(this.editor&&this.editor._enabled){this.editor.updateStyle()}else{this._renderText()}},updateStyle:function(){var t=this._textNode;var e=this.options;if(null!==t){t.setAttribute("font-family",e.fontFamily);t.setAttribute("font-size",e.fontSize+"px");t.setAttribute("fill",e.fontColor)}},_renderText:function(){if(this._renderer){this._textNode=this._renderer.renderText(this);this._path.parentNode.insertBefore(this._textNode,this._path.nextSibling);this.updateStyle();this._updatePosition()}},_updatePosition:function(){if(null!==this._textNode&&0!==this._rings.length){var t=this._rings[0][1];var e=new L.Matrix(1,0,0,1,0,0).translate(t).scale(this._getScale(this._map.getZoom()));this._textNode.setAttribute("transform","matrix("+e._matrix.join(" ")+")")}},_getScale:function(t){return this._map?Math.pow(2,t)*this.options.ratio:1},_updatePath:function(){L.Rectangle.prototype._updatePath.call(this);this._updatePosition()}})},{}],6:[function(t,e,i){L.DomUtil.setSize=L.DomUtil.setSize||function(t,e){t.style.width=e.x+"px";t.style.height=e.y+"px";return this}},{}]},{},[1])(1)});
var n=12;var r=1.12;L.SVG.calcFontSize=L.SVG.calcFontSize||function(t){var e=n;var i=Number.MAX_VALUE;var r=Number.MIN_VALUE;var a=t.querySelectorAll("text");var o;var s;if(0<a.length){e=0;for(var l=a.length-1;0<=l;--l){s=a[l].getAttribute("font-size");if(null!==s){o=parseFloat(a[l].getAttribute("font-size"));e+=o;if(i>o){i=o}if(r<o){r=o}}}return{size:Math.round(e/a.length+.5),min:Math.round(i+.5),max:Number.MIN_VALUE===r?e:Math.round(r+.5)}}return{size:e,min:e,max:e}};L.SVG.include({renderText:function(t){var e=t._textNode;var i=t._text;if(e){e.parentNode.removeChild(e)}e=t._textNode=L.SVG.create("text");t.updateStyle();this._rootGroup.appendChild(e);if(i){var n=t._getScale(this._map.getZoom());var a=t.getBounds();var o=t._map.latLngToLayerPoint(a.getCenter());var s=t._map.latLngToLayerPoint(a.getNorthWest());var l=L.point(2*Math.abs(o.x-s.x),2*Math.abs(o.y-s.y)).divideBy(n);var d=i.split("");var f=d.shift();var u=d.shift();var h=1;var x=l.x-t.options.padding;var p=this._textMakeNextLine(e,f,{x:t.options.padding});var _=e.getBBox().height;p.setAttribute("dy",_);while(u){if(" "===u){f+=u}else if("\n"===u){f="";p=this._textMakeNextLine(e,f,{x:t.options.padding,dy:r*_})}else if(" "!==u){var c=f;f+=u;p.firstChild.nodeValue=f;var m=t.options.padding+p.getComputedTextLength();if(m>x&&1<=f.length){++h;p.firstChild.nodeValue=c.replace(/\s*$/gm,"");c="";f=u;p=this._textMakeNextLine(e,f,{x:t.options.padding,dy:r*_})}}u=d.shift()}}else if(null!==e){e.parentNode.removeChild(e);e=null}return e},_textMakeNextLine:function(t,e,i){var n=L.SVG.create("tspan");var r;for(r in i||{}){if(i.hasOwnProperty(r)){n.setAttribute(r,i[r])}}n.appendChild(document.createTextNode(e||""));t.appendChild(n);return n}})},{}],5:[function(t,e,i){L.TextBox=L.Rectangle.extend({options:{padding:2,fontSize:12,fillOpacity:.5,fillColor:"#ffffff",weight:1,fontColor:"",fontFamily:"",ratio:1,text:"Please, add text"},initialize:function(t,e){L.Rectangle.prototype.initialize.call(this,t,e);this._text=this.options.text;this._textNode=null},setStyle:function(t){L.setOptions(this,t);if(this.editor&&this.editor._enabled){this.editor.updateStyle()}else{this._renderText()}},updateStyle:function(){var t=this._textNode;var e=this.options;if(null!==t){t.setAttribute("font-family",e.fontFamily);t.setAttribute("font-size",e.fontSize+"px");t.setAttribute("fill",e.fontColor)}},onRemove:function(t){if(null!==this._textNode){if(null!==this._textNode.parentNode){this._textNode.parentNode.removeChild(this._textNode)}this._textNode=null}L.Rectangle.prototype.onRemove.call(this,t)},_renderText:function(){if(this._renderer){this._textNode=this._renderer.renderText(this);this._path.parentNode.insertBefore(this._textNode,this._path.nextSibling);this.updateStyle();this._updatePosition()}},_updatePosition:function(){if(null!==this._textNode){var t=this.getBounds();var e=this._map.latLngToLayerPoint(t.getNorthWest());var i=new L.Matrix(1,0,0,1,0,0).translate(e).scale(this._getScale(this._map.getZoom()));this._textNode.setAttribute("transform","matrix("+i._matrix.join(" ")+")")}},_getScale:function(t){return this._map?Math.pow(2,t)*this.options.ratio:1},_updatePath:function(){L.Rectangle.prototype._updatePath.call(this);this._updatePosition()}})},{}],6:[function(t,e,i){L.DomUtil.setSize=L.DomUtil.setSize||function(t,e){t.style.width=e.x+"px";t.style.height=e.y+"px";return this}},{}]},{},[1])(1)});
{
"name": "leaflet-editable-textbox",
"version": "1.0.16",
"version": "1.0.17",
"description": "TextBox for Leaflet.Editable",

@@ -26,5 +26,2 @@ "main": "index.js",

"devDependencies": {
"leaflet": "^1.0.0-beta.2",
"rimraf": "*",
"leaflet-editable": "github:leaflet/leaflet.editable#gh-pages",
"babel-preset-es2015": "^6.3.13",

@@ -36,3 +33,6 @@ "babelify": "^7.2.0",

"faucet": "0.0.1",
"leaflet": "^1.0.0-rc.3",
"leaflet-editable": "^1.0.0-rc.1",
"leaflet-schematic": "^1.0.0-beta.1",
"rimraf": "*",
"serve": "^1.4.0",

@@ -39,0 +39,0 @@ "tape": "^4.4.0",

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