@@ -191,8 +191,11 @@ caDrawHelper.prototype.drawPolygon = function(ctx, paths){
191191caDrawHelper . prototype . draw = function ( ctx , image_data ) {
192192 for ( let i = 0 ; i < image_data . length ; i ++ ) {
193193 const polygon = image_data [ i ] ;
194+ if ( polygon . properties == undefined || polygon . properties == null ) {
195+ polygon . properties = { }
196+ }
194197 const style = polygon . properties . style ;
195-
198+
196199 // if there is path using path to draw
197200 // if(polygon.geometry.path){
198201 // ctx.fillStyle = hexToRgbA(style.color,0.5);
@@ -287,6 +290,9 @@ caDrawHelper.prototype.doesDraw = function(bbox, ctx){
287290
288291caDrawHelper . prototype . drawGrids = function ( ctx , image_data ) {
289292 image_data . forEach ( polygon => {
293+ if ( polygon . properties == undefined || polygon . properties == null ) {
294+ polygon . properties = { }
295+ }
290296 const style = polygon . properties . style ;
291297 const size = polygon . properties . size ;
292298 //this.setStyle(ctx, style);
@@ -297,6 +303,9 @@ caDrawHelper.prototype.drawGrids = function(ctx, image_data){
297303 } )
298304}
299305caDrawHelper . prototype . drawGrid = function ( ctx , polygon ) {
306+ if ( polygon . properties == undefined || polygon . properties == null ) {
307+ polygon . properties = { }
308+ }
300309 const style = polygon . properties . style ;
301310 const size = polygon . properties . size ;
302311 //this.setStyle(ctx, style);
@@ -330,6 +339,14 @@ caDrawHelper.prototype.drawGrid = function(ctx, polygon){
330339 * how the end points of every line are drawn. There are three possible values: 'butt', 'round' and 'square'
331340 */
332341caDrawHelper . prototype . setStyle = function ( ctx , style ) {
342+ if ( style == undefined || style == null ) {
343+ style = {
344+ "color" :"#fccde5" ,
345+ "lineJoin" :"round" ,
346+ "lineCap" :"round" ,
347+ "isFill" :true
348+ } ;
349+ }
333350 ctx . strokeStyle = style . color ;
334351 ctx . lineJoin = style . lineJoin ;
335352 ctx . lineCap = style . lineCap ;
0 commit comments