Skip to content

Commit

Permalink
Fixed color style in pdf print (#2792)
Browse files Browse the repository at this point in the history
* Fixed color style in pdf print

* Tinycolor version

# Conflicts:
#	web/client/utils/PrintUtils.js
  • Loading branch information
mbarto committed May 17, 2018
1 parent e4f24bf commit 30c6d1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
"leaflet-extra-markers": "1.0.6",
"leaflet-minimap": "3.6.0",
"leaflet-plugins": "3.0.2",
"leaflet.gridlayer.googlemutant": "0.6.4",
"leaflet-simple-graticule": "1.0.2",
"leaflet.gridlayer.googlemutant": "0.6.4",
"leaflet.locatecontrol": "0.62.0",
"leaflet.nontiledlayer": "1.0.7",
"lodash": "4.16.6",
Expand Down Expand Up @@ -185,6 +185,7 @@
"rxjs": "5.1.1",
"screenfull": "3.1.0",
"shpjs": "3.4.2",
"tinycolor2": "1.4.1",
"turf-bbox": "3.0.10",
"turf-buffer": "3.0.10",
"turf-intersect": "3.0.10",
Expand Down
2 changes: 2 additions & 0 deletions web/client/utils/ColorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
const tinycolor = require("tinycolor2");
const {toNumber} = require("lodash");

/**
* Porting of various MapStore(1) utilities for random/color scale generations
* @name ColorUtils
Expand Down Expand Up @@ -157,6 +158,7 @@ const ColorUtils = {
return ColorUtils.rgbToHsv(rgb);
}
},
colorToHexStr: (color = 'red') => tinycolor(color).toHexString(),
/**
* Return with position of a character in this.HCHARS string
* @private
Expand Down
5 changes: 3 additions & 2 deletions web/client/utils/PrintUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
const CoordinatesUtils = require('./CoordinatesUtils');
const MapUtils = require('./MapUtils');
const AnnotationsUtils = require("./AnnotationsUtils");
const {colorToHexStr} = require("./ColorUtils");

const {isArray} = require('lodash');

Expand Down Expand Up @@ -342,14 +343,14 @@ const PrintUtils = {
}
// commented the available options.
return {
"fillColor": PrintUtils.rgbaTorgb(style.fillColor),
"fillColor": colorToHexStr(style.fillColor),
"fillOpacity": style.fillOpacity,
// "rotation": "30",
"externalGraphic": style.iconUrl,
// "graphicName": "circle",
// "graphicOpacity": 0.4,
"pointRadius": style.radius,
"strokeColor": PrintUtils.rgbaTorgb(style.color),
"strokeColor": colorToHexStr(style.fillColor),
"strokeOpacity": style.opacity,
"strokeWidth": style.weight
// "strokeLinecap": "round",
Expand Down

0 comments on commit 30c6d1c

Please sign in to comment.