ig_markerfactory
Advanced tools
Comparing version 2.7.5 to 2.7.6
@@ -453,3 +453,3 @@ var MarkerFactory = {}; | ||
var generateTransparentCanvas = function (options) { | ||
var canvas = document.createElement("canvas"); | ||
var canvas = options.canvas || document.createElement("canvas"); | ||
@@ -474,15 +474,46 @@ canvas.width = 54; | ||
context.beginPath(); | ||
context.font = "40px '" + options.font + "'"; | ||
context.fillStyle = color0; | ||
context.strokeStyle = color1; | ||
context.textBaseline = "top"; | ||
var textWidth = context.measureText(options.label); | ||
context.fillText(options.label, 1 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 49 - canvas.height); | ||
var textWidth = context.measureText(options.unicodelabel), | ||
text_x = Math.floor((canvas.width / 2) - (textWidth.width / 2)); | ||
if (options.shadow) { | ||
context.shadowOffsetX = -4; | ||
context.shadowOffsetY = 3; | ||
context.shadowBlur = 2; | ||
context.shadowColor = color1; | ||
var grad = context.createLinearGradient(text_x, 0, canvas.width, canvas.height); | ||
grad.addColorStop(0, '#FFFFFF'); | ||
grad.addColorStop(0.5, '#FFFFFF'); | ||
grad.addColorStop(1, color0); | ||
//console.debug('applying shadow'); | ||
context.shadowOffsetX = -2; | ||
context.shadowOffsetY = -2; | ||
context.shadowBlur = 0; | ||
context.fillStyle = '#FFFFFF'; | ||
context.shadowColor = '#666666'; | ||
context.fillText(options.unicodelabel, text_x - 4, 0); | ||
context.fillText(options.unicodelabel, text_x, 3); | ||
context.fillStyle = grad; | ||
context.fillText(options.unicodelabel, text_x + 4, 6); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 4, 6); | ||
} else { | ||
context.shadowOffsetX = 2; | ||
context.shadowOffsetY = 2; | ||
context.shadowBlur = 0; | ||
context.shadowColor = '#FFFFFF'; | ||
context.fillStyle = color0; | ||
context.fillText(options.unicodelabel, text_x + 1, 0); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 1, 0); | ||
} | ||
context.strokeText(options.label, 2 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 50 - canvas.height); | ||
@@ -497,2 +528,6 @@ canvas.fillColor = color0; | ||
var scale = theoptions.scale; | ||
if (theoptions.shadow) { | ||
scale = 0.9 * scale; | ||
} | ||
var iconObj = { | ||
@@ -508,11 +543,13 @@ canvas: markerCanvas, | ||
Object.assign(iconObj, { | ||
size: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale), | ||
size: new google.maps.Size(54 * scale, 48 * scale), | ||
origin: new google.maps.Point(0, 0), | ||
anchor: new google.maps.Point(27 * theoptions.scale, 40 * theoptions.scale), | ||
scaledSize: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale) | ||
anchor: new google.maps.Point(27 * scale, 39 * scale), | ||
scaledSize: new google.maps.Size(54 * scale, 48 * scale) | ||
}); | ||
} | ||
//console.debug('createTransparentMarkerIcon', iconObj); | ||
return iconObj; | ||
}; | ||
MarkerFactory.toDecColor = toDecColor; | ||
@@ -519,0 +556,0 @@ |
@@ -459,3 +459,3 @@ (function (global, factory) { | ||
var generateTransparentCanvas = function (options) { | ||
var canvas = document.createElement("canvas"); | ||
var canvas = options.canvas || document.createElement("canvas"); | ||
@@ -480,15 +480,46 @@ canvas.width = 54; | ||
context.beginPath(); | ||
context.font = "40px '" + options.font + "'"; | ||
context.fillStyle = color0; | ||
context.strokeStyle = color1; | ||
context.textBaseline = "top"; | ||
var textWidth = context.measureText(options.label); | ||
context.fillText(options.label, 1 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 49 - canvas.height); | ||
var textWidth = context.measureText(options.unicodelabel), | ||
text_x = Math.floor((canvas.width / 2) - (textWidth.width / 2)); | ||
if (options.shadow) { | ||
context.shadowOffsetX = -4; | ||
context.shadowOffsetY = 3; | ||
context.shadowBlur = 2; | ||
context.shadowColor = color1; | ||
var grad = context.createLinearGradient(text_x, 0, canvas.width, canvas.height); | ||
grad.addColorStop(0, '#FFFFFF'); | ||
grad.addColorStop(0.5, '#FFFFFF'); | ||
grad.addColorStop(1, color0); | ||
//console.debug('applying shadow'); | ||
context.shadowOffsetX = -2; | ||
context.shadowOffsetY = -2; | ||
context.shadowBlur = 0; | ||
context.fillStyle = '#FFFFFF'; | ||
context.shadowColor = '#666666'; | ||
context.fillText(options.unicodelabel, text_x - 4, 0); | ||
context.fillText(options.unicodelabel, text_x, 3); | ||
context.fillStyle = grad; | ||
context.fillText(options.unicodelabel, text_x + 4, 6); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 4, 6); | ||
} else { | ||
context.shadowOffsetX = 2; | ||
context.shadowOffsetY = 2; | ||
context.shadowBlur = 0; | ||
context.shadowColor = '#FFFFFF'; | ||
context.fillStyle = color0; | ||
context.fillText(options.unicodelabel, text_x + 1, 0); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 1, 0); | ||
} | ||
context.strokeText(options.label, 2 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 50 - canvas.height); | ||
@@ -503,2 +534,6 @@ canvas.fillColor = color0; | ||
var scale = theoptions.scale; | ||
if (theoptions.shadow) { | ||
scale = 0.9 * scale; | ||
} | ||
var iconObj = { | ||
@@ -514,11 +549,13 @@ canvas: markerCanvas, | ||
Object.assign(iconObj, { | ||
size: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale), | ||
size: new google.maps.Size(54 * scale, 48 * scale), | ||
origin: new google.maps.Point(0, 0), | ||
anchor: new google.maps.Point(27 * theoptions.scale, 40 * theoptions.scale), | ||
scaledSize: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale) | ||
anchor: new google.maps.Point(27 * scale, 39 * scale), | ||
scaledSize: new google.maps.Size(54 * scale, 48 * scale) | ||
}); | ||
} | ||
//console.debug('createTransparentMarkerIcon', iconObj); | ||
return iconObj; | ||
}; | ||
MarkerFactory.toDecColor = toDecColor; | ||
@@ -525,0 +562,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"jsnext:main": "markerfactory.esm.js", | ||
"version": "2.7.5", | ||
"version": "2.7.6", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -453,3 +453,3 @@ var MarkerFactory = {}; | ||
var generateTransparentCanvas = function (options) { | ||
var canvas = document.createElement("canvas"); | ||
var canvas = options.canvas || document.createElement("canvas"); | ||
@@ -474,15 +474,46 @@ canvas.width = 54; | ||
context.beginPath(); | ||
context.font = "40px '" + options.font + "'"; | ||
context.fillStyle = color0; | ||
context.strokeStyle = color1; | ||
context.textBaseline = "top"; | ||
var textWidth = context.measureText(options.label); | ||
context.fillText(options.label, 1 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 49 - canvas.height); | ||
var textWidth = context.measureText(options.unicodelabel), | ||
text_x = Math.floor((canvas.width / 2) - (textWidth.width / 2)); | ||
if (options.shadow) { | ||
context.shadowOffsetX = -4; | ||
context.shadowOffsetY = 3; | ||
context.shadowBlur = 2; | ||
context.shadowColor = color1; | ||
var grad = context.createLinearGradient(text_x, 0, canvas.width, canvas.height); | ||
grad.addColorStop(0, '#FFFFFF'); | ||
grad.addColorStop(0.5, '#FFFFFF'); | ||
grad.addColorStop(1, color0); | ||
//console.debug('applying shadow'); | ||
context.shadowOffsetX = -2; | ||
context.shadowOffsetY = -2; | ||
context.shadowBlur = 0; | ||
context.fillStyle = '#FFFFFF'; | ||
context.shadowColor = '#666666'; | ||
context.fillText(options.unicodelabel, text_x - 4, 0); | ||
context.fillText(options.unicodelabel, text_x, 3); | ||
context.fillStyle = grad; | ||
context.fillText(options.unicodelabel, text_x + 4, 6); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 4, 6); | ||
} else { | ||
context.shadowOffsetX = 2; | ||
context.shadowOffsetY = 2; | ||
context.shadowBlur = 0; | ||
context.shadowColor = '#FFFFFF'; | ||
context.fillStyle = color0; | ||
context.fillText(options.unicodelabel, text_x + 1, 0); | ||
context.strokeStyle = color1; | ||
context.strokeText(options.unicodelabel, text_x + 1, 0); | ||
} | ||
context.strokeText(options.label, 2 + Math.floor((canvas.width / 2) - (textWidth.width / 2)), 50 - canvas.height); | ||
@@ -497,2 +528,6 @@ canvas.fillColor = color0; | ||
var scale = theoptions.scale; | ||
if (theoptions.shadow) { | ||
scale = 0.9 * scale; | ||
} | ||
var iconObj = { | ||
@@ -508,11 +543,13 @@ canvas: markerCanvas, | ||
Object.assign(iconObj, { | ||
size: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale), | ||
size: new google.maps.Size(54 * scale, 48 * scale), | ||
origin: new google.maps.Point(0, 0), | ||
anchor: new google.maps.Point(27 * theoptions.scale, 40 * theoptions.scale), | ||
scaledSize: new google.maps.Size(54 * theoptions.scale, 48 * theoptions.scale) | ||
anchor: new google.maps.Point(27 * scale, 39 * scale), | ||
scaledSize: new google.maps.Size(54 * scale, 48 * scale) | ||
}); | ||
} | ||
//console.debug('createTransparentMarkerIcon', iconObj); | ||
return iconObj; | ||
}; | ||
MarkerFactory.toDecColor = toDecColor; | ||
@@ -519,0 +556,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1370203
4635