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

leaflet-editable-textbox

Package Overview
Dependencies
Maintainers
1
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.5 to 1.0.6

163

dist/L.Editable.Textbox-src.js

@@ -12,6 +12,7 @@ (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){

require('./src/Editable.Textbox');
require('./src/SVG');
module.exports = L.Editable.TextBoxEditor;
},{"./src/Editable.Textbox":3,"./src/Textbox":4,"./src/Util":5,"leaflet":undefined,"leaflet-editable":undefined,"leaflet-path-transform/src/Matrix":2}],2:[function(require,module,exports){
},{"./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(require,module,exports){
/**

@@ -290,2 +291,3 @@ * @class L.Matrix

this._text = this.feature._text;
if (this._text) {

@@ -298,2 +300,7 @@ this._textArea.innerHTML = this._text;

if (this.feature._textNode) {
this.feature._textNode.parentNode.removeChild(this.feature._textNode);
this.feature._textNode = null;
}
return this;

@@ -330,2 +337,4 @@ },

}
this.feature._text = this._text;
this.feature._renderText();
}

@@ -410,13 +419,3 @@

}
var ret = L.Rectangle.prototype.enableEdit.call(this, map);
if (this._textNode) {
this._textNode.parentNode.removeChild(this._textNode);
this._textNode = null;
}
ret = L.Rectangle.prototype.enableEdit.call(this, map);
this.editor.setText(this._text);
return ret;
return L.Rectangle.prototype.enableEdit.call(this, map);
},

@@ -431,3 +430,2 @@

L.Rectangle.prototype.disableEdit.call(this);
this._renderText();

@@ -457,3 +455,138 @@ return this;

},{}],4:[function(require,module,exports){
/**
* SVG tools
*
* @author rumax
* @license MIT
* @preserve
*/
var DEFAULT_SIZE = 12;
var LINE_FACTOR = 1.12;
/**
* @param {SVGElement} svg
* @return {Object}
*/
L.SVG.calcFontSize = L.SVG.calcFontSize || function(svg) {
var size = DEFAULT_SIZE;
var sizeMin = Number.MAX_VALUE;
var sizeMax = Number.MIN_VALUE;
var texts = svg.querySelectorAll('text');
var textSize;
if (0 < texts.length) {
size = 0;
for (var ind = texts.length - 1; 0 <= ind; --ind) {
textSize = parseFloat(texts[ind].getAttribute('font-size'));
size += textSize;
if (sizeMin > textSize) {
sizeMin = textSize;
}
if (sizeMax < textSize) {
sizeMax = textSize;
}
}
return {
size: Math.round(size / texts.length + 0.5),
min: Math.round(sizeMin + 0.5),
max: Number.MIN_VALUE === sizeMax ? size : Math.round(sizeMax + 0.5)
};
}
return {
size: size,
min: size,
max: size
};
};
L.SVG.include({
renderText: function(layer) {
var textElement = layer._textNode;
var text = layer._text;
if (textElement) {
textElement.parentNode.removeChild(textElement);
}
textElement = layer._textNode = L.SVG.create('text');
layer.updateStyle();
this._rootGroup.appendChild(textElement);
if (text) {
var scale = layer._getScale(this._map.getZoom());
var pos = layer._rings[0][1];
var size = layer._rings[0][3].subtract(pos).divideBy(scale);
var chars = text.split('');
var line = chars.shift();
var char = chars.shift();
var lineInd = 1;
var maxWidth = size.x - layer.options.padding;
var tspan = this._textMakeNextLine(textElement, line, {
x: layer.options.padding
});
var lineHeight = textElement.getBBox().height;
tspan.setAttribute('dy', lineHeight);
while (char) {
if (' ' === char) {
line += char;
} else if ('\n' === char) {
line = '';
tspan = this._textMakeNextLine(textElement, line, {
x: layer.options.padding,
dy: LINE_FACTOR * lineHeight
});
} else if ('\t' !== char) { //skip tabs
var prevLine = line;
line += char;
tspan.firstChild.nodeValue = line;
var lineLength = layer.options.padding +
tspan.getComputedTextLength();
if (lineLength > maxWidth && 1 <= line.length) {
++lineInd;
tspan.firstChild.nodeValue = prevLine.replace(/\s*$/gm, '');
prevLine = '';
line = char;
tspan = this._textMakeNextLine(textElement, line, {
x: layer.options.padding,
dy: LINE_FACTOR * lineHeight
});
}
}
char = chars.shift();
}
} else if (null !== textElement) {
textElement.parentNode.removeChild(textElement);
textElement = null;
}
return textElement;
},
_textMakeNextLine: function(container, text, attrs) {
var tspan = L.SVG.create('tspan');
var key;
for (key in attrs || {}) {
if (attrs.hasOwnProperty(key)) {
tspan.setAttribute(key, attrs[key]);
}
}
tspan.appendChild(document.createTextNode(text || ''));
container.appendChild(tspan);
return tspan;
}
});
},{}],5:[function(require,module,exports){
L.TextBox = L.Rectangle.extend({

@@ -543,3 +676,3 @@

},{}],5:[function(require,module,exports){
},{}],6:[function(require,module,exports){
/**

@@ -558,2 +691,2 @@ * @param {Element} element

});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9sZWFmbGV0LXBhdGgtdHJhbnNmb3JtL3NyYy9NYXRyaXguanMiLCJzcmMvRWRpdGFibGUuVGV4dGJveC5qcyIsInNyYy9UZXh0Ym94LmpzIiwic3JjL1V0aWwuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUF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AgdmFyIHBvcyA9IHRoaXMuX3JpbmdzWzBdWzFdO1xuICAgICAgdmFyIHRleHRNYXRyaXggPSBuZXcgTC5NYXRyaXgoMSwgMCwgMCwgMSwgMCwgMClcbiAgICAgICAgLnRyYW5zbGF0ZShwb3MpXG4gICAgICAgIC5zY2FsZSh0aGlzLl9nZXRTY2FsZSh0aGlzLl9tYXAuZ2V0Wm9vbSgpKSk7XG4gICAgICB0aGlzLl90ZXh0Tm9kZS5zZXRBdHRyaWJ1dGUoJ3RyYW5zZm9ybScsXG4gICAgICAgICdtYXRyaXgoJyArIHRleHRNYXRyaXguX21hdHJpeC5qb2luKCcgJykgKyAnKScpO1xuICAgIH1cbiAgfSxcblxuXG4gIF9nZXRTY2FsZTogZnVuY3Rpb24oem9vbSkge1xuICAgIHJldHVybiAodGhpcy5fbWFwID9cbiAgICAgIE1hdGgucG93KDIsIHpvb20pICogdGhpcy5vcHRpb25zLnJhdGlvIDogMSk7XG4gIH0sXG5cblxuICBfdXBkYXRlUGF0aDogZnVuY3Rpb24oKSB7XG4gICAgTC5SZWN0YW5nbGUucHJvdG90eXBlLl91cGRhdGVQYXRoLmNhbGwodGhpcyk7XG4gICAgdGhpcy5fdXBkYXRlUG9zaXRpb24oKTtcbiAgfVxuXG59KTtcbiIsIi8qKlxuICogQHBhcmFtICB7RWxlbWVudH0gZWxlbWVudFxuICogQHBhcmFtICB7TC5Qb2ludH0gc2l6ZVxuICogQHJldHVybiB7T2JqZWN0fSBzZWxmXG4gKi9cbkwuRG9tVXRpbC5zZXRTaXplID0gIEwuRG9tVXRpbC5zZXRTaXplIHx8IGZ1bmN0aW9uKGVsZW1lbnQsIHNpemUpIHtcbiAgZWxlbWVudC5zdHlsZS53aWR0aCA9IHNpemUueCAgKyAncHgnO1xuICBlbGVtZW50LnN0eWxlLmhlaWdodCA9IHNpemUueSArICdweCc7XG4gIHJldHVybiB0aGlzO1xufTtcbiJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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cbiAgICAgICAgfSBlbHNlIGlmICgnXFxuJyA9PT0gY2hhcikge1xuICAgICAgICAgIGxpbmUgPSAnJztcbiAgICAgICAgICB0c3BhbiA9IHRoaXMuX3RleHRNYWtlTmV4dExpbmUodGV4dEVsZW1lbnQsIGxpbmUsIHtcbiAgICAgICAgICAgIHg6IGxheWVyLm9wdGlvbnMucGFkZGluZyxcbiAgICAgICAgICAgIGR5OiBMSU5FX0ZBQ1RPUiAqIGxpbmVIZWlnaHRcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIGlmICgnXFx0JyAhPT0gY2hhcikgeyAvL3NraXAgdGFic1xuICAgICAgICAgIHZhciBwcmV2TGluZSA9IGxpbmU7XG4gICAgICAgICAgbGluZSArPSBjaGFyO1xuICAgICAgICAgIHRzcGFuLmZpcnN0Q2hpbGQubm9kZVZhbHVlID0gbGluZTtcbiAgICAgICAgICB2YXIgbGluZUxlbmd0aCA9IGxheWVyLm9wdGlvbnMucGFkZGluZyArXG4gICAgICAgICAgICB0c3Bhbi5nZXRDb21wdXRlZFRleHRMZW5ndGgoKTtcblxuICAgICAgICAgIGlmIChsaW5lTGVuZ3RoID4gbWF4V2lkdGggJiYgMSA8PSBsaW5lLmxlbmd0aCkge1xuICAgICAgICAgICAgKytsaW5lSW5kO1xuICAgICAgICAgICAgdHNwYW4uZmlyc3RDaGlsZC5ub2RlVmFsdWUgPSBwcmV2TGluZS5yZXBsYWNlKC9cXHMqJC9nbSwgJycpO1xuICAgICAgICAgICAgcHJldkxpbmUgPSAnJztcbiAgICAgICAgICAgIGxpbmUgPSBjaGFyO1xuICAgICAgICAgICAgdHNwYW4gPSB0aGlzLl90ZXh0TWFrZU5leHRMaW5lKHRleHRFbGVtZW50LCBsaW5lLCB7XG4gICAgICAgICAgICAgIHg6IGxheWVyLm9wdGlvbnMucGFkZGluZyxcbiAgICAgICAgICAgICAgZHk6IExJTkVfRkFDVE9SICogbGluZUhlaWdodFxuICAgICAgICAgICAgfSk7XG4g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Y3RhbmdsZS5wcm90b3R5cGUuX3VwZGF0ZVBhdGguY2FsbCh0aGlzKTtcbiAgICB0aGlzLl91cGRhdGVQb3NpdGlvbigpO1xuICB9XG5cbn0pO1xuIiwiLyoqXG4gKiBAcGFyYW0gIHtFbGVtZW50fSBlbGVtZW50XG4gKiBAcGFyYW0gIHtMLlBvaW50fSBzaXplXG4gKiBAcmV0dXJuIHtPYmplY3R9IHNlbGZcbiAqL1xuTC5Eb21VdGlsLnNldFNpemUgPSAgTC5Eb21VdGlsLnNldFNpemUgfHwgZnVuY3Rpb24oZWxlbWVudCwgc2l6ZSkge1xuICBlbGVtZW50LnN0eWxlLndpZHRoID0gc2l6ZS54ICArICdweCc7XG4gIGVsZW1lbnQuc3R5bGUuaGVpZ2h0ID0gc2l6ZS55ICsgJ3B4JztcbiAgcmV0dXJuIHRoaXM7XG59O1xuIl19

@@ -1,2 +0,2 @@

(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(a,s){if(!e[a]){if(!t[a]){var l=typeof require=="function"&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var d=e[a]={exports:{}};t[a][0].call(d.exports,function(e){var i=t[a][1][e];return r(i?i:e)},d,d.exports,n,t,e,i)}return e[a].exports}var o=typeof require=="function"&&require;for(var a=0;a<i.length;a++)r(i[a]);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");e.exports=n.Editable.TextBoxEditor},{"./src/Editable.Textbox":3,"./src/Textbox":4,"./src/Util":5,leaflet:undefined,"leaflet-editable":undefined,"leaflet-path-transform/src/Matrix":2}],2:[function(t,e,i){L.Matrix=function(t,e,i,n,r,o){this._matrix=[t,e,i,n,r,o]};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,o){var a=[[],[],[]];var s=this._matrix;var l=[[s[0],s[2],s[4]],[s[1],s[3],s[5]],[0,0,1]];var f=[[t,i,r],[e,n,o],[0,0,1]],d;if(t&&t instanceof L.Matrix){s=t._matrix;f=[[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++){d=0;for(var x=0;x<3;x++){d+=l[u][x]*f[x][h]}a[u][h]=d}}this._matrix=[a[0][0],a[1][0],a[0][1],a[1][1],a[0][2],a[1][2]];return this}};L.matrix=function(t,e,i,n,r,o){return new L.Matrix(t,e,i,n,r,o)}},{}],3:[function(t,e,i){/**
(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){/**
* TextBox

@@ -7,2 +7,9 @@ *

*/
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";this.updateStyle();this.map.getPane("markerPane").appendChild(this._textArea);if(this._text){this._textArea.innerHTML=this._text}this._updateTextAreaBounds()}return this},setText:function(t){this._text=t;if(null!==this._textArea){this._textArea.value=t}},getText:function(){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();this._textArea.parentNode.removeChild(this._textArea);this._textArea=null}}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(){if(null!==this._textArea){L.Util.requestAnimFrame(function(){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 o=r._bounds;var a=this._textArea;var s=this.map;if(null!==a){if(null!==o){t=r._getScale(s.getZoom());e=r._boundsToLatLngs(o);i=s.latLngToLayerPoint(e[1]);n=s.latLngToLayerPoint(e[3]).subtract(i);L.DomUtil.setSize(a,n.divideBy(t).round()).setTransform(a,i,t.toFixed(3));a.style.display="";a.style.position="absolute";a.setAttribute("spellcheck",false);this._focus()}else{a.style.display="none"}}return this}});L.TextBox.include({enableEdit:function(t){if(!this.editor){this.createEditor(t)}var e=L.Rectangle.prototype.enableEdit.call(this,t);if(this._textNode){this._textNode.parentNode.removeChild(this._textNode);this._textNode=null}e=L.Rectangle.prototype.enableEdit.call(this,t);this.editor.setText(this._text);return e},disableEdit:function(){if(this.editor){this._text=this.editor.getText()}L.Rectangle.prototype.disableEdit.call(this);this._renderText();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.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(){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()}})},{}],5:[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)});
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";this.updateStyle();this.map.getPane("markerPane").appendChild(this._textArea);this._text=this.feature._text;if(this._text){this._textArea.innerHTML=this._text}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(){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();this._textArea.parentNode.removeChild(this._textArea);this._textArea=null}this.feature._text=this._text;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(){if(null!==this._textArea){L.Util.requestAnimFrame(function(){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){/**
* SVG tools
*
* @author rumax
* @license MIT
* @preserve
*/
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 c=l;l+=d;h.firstChild.nodeValue=l;var p=t.options.padding+h.getComputedTextLength();if(p>u&&1<=l.length){++f;h.firstChild.nodeValue=c.replace(/\s*$/gm,"");c="";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(){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)});

@@ -11,3 +11,4 @@ /*eslint no-undef: "error"*/

require('./src/Editable.Textbox');
require('./src/SVG');
module.exports = L.Editable.TextBoxEditor;

2

package.json
{
"name": "leaflet-editable-textbox",
"version": "1.0.5",
"version": "1.0.6",
"description": "TextBox for Leaflet.Editable",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -68,2 +68,3 @@ /**

this._text = this.feature._text;
if (this._text) {

@@ -76,2 +77,7 @@ this._textArea.innerHTML = this._text;

if (this.feature._textNode) {
this.feature._textNode.parentNode.removeChild(this.feature._textNode);
this.feature._textNode = null;
}
return this;

@@ -108,2 +114,4 @@ },

}
this.feature._text = this._text;
this.feature._renderText();
}

@@ -188,13 +196,3 @@

}
var ret = L.Rectangle.prototype.enableEdit.call(this, map);
if (this._textNode) {
this._textNode.parentNode.removeChild(this._textNode);
this._textNode = null;
}
ret = L.Rectangle.prototype.enableEdit.call(this, map);
this.editor.setText(this._text);
return ret;
return L.Rectangle.prototype.enableEdit.call(this, map);
},

@@ -209,3 +207,2 @@

L.Rectangle.prototype.disableEdit.call(this);
this._renderText();

@@ -212,0 +209,0 @@ return this;

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