Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undeclared variables in src/filter/Fold.js #225

Merged
merged 1 commit into from
Dec 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions src/filter/Fold.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Copyright (c) 2017 Jean-Marc VIGLINO,
/* Copyright (c) 2017 Jean-Marc VIGLINO,
released under the CeCILL-B license (French BSD license)
(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).
*/

import {inherits as ol_inherits} from 'ol'
import ol_filter_Base from './Base'

/** Fold filer map
/** Fold filer map
* @constructor
* @requires ol_filter
* @extends {ol_filter_Base}
Expand All @@ -19,7 +19,7 @@ import ol_filter_Base from './Base'
var ol_filter_Fold = function(options)
{ options = options || {};
ol_filter_Base.call(this, options);

this.set("fold", options.fold || [8,4]);
this.set("margin", options.margin || 8);
this.set("padding", options.padding || 8);
Expand All @@ -33,25 +33,26 @@ ol_filter_Fold.prototype.drawLine_ = function(ctx, d, m)
var fold = this.get("fold");
var w = canvas.width;
var h = canvas.height;
var x, y, i;

ctx.beginPath();
ctx.moveTo ( m, m );
for (var i=1; i<=fold[0]; i++)
for (i=1; i<=fold[0]; i++)
{ x = i*w/fold[0] - (i==fold[0] ? m : 0);
y = d[1]*(i%2) +m;
ctx.lineTo ( x, y );
}
for (var i=1; i<=fold[1]; i++)
for (i=1; i<=fold[1]; i++)
{ x = w - d[0]*(i%2) - m;
y = i*h/fold[1] - (i==fold[1] ? d[0]*(fold[0]%2) + m : 0);
ctx.lineTo ( x, y );
}
for (var i=fold[0]; i>0; i--)
for (i=fold[0]; i>0; i--)
{ x = i*w/fold[0] - (i==fold[0] ? d[0]*(fold[1]%2) + m : 0);
y = h - d[1]*(i%2) -m;
ctx.lineTo ( x, y );
}
for (var i=fold[1]; i>0; i--)
for (i=fold[1]; i>0; i--)
{ x = d[0]*(i%2) + m;
y = i*h/fold[1] - (i==fold[1] ? m : 0);
ctx.lineTo ( x, y );
Expand All @@ -61,12 +62,7 @@ ol_filter_Fold.prototype.drawLine_ = function(ctx, d, m)

ol_filter_Fold.prototype.precompose = function(e)
{ var ctx = e.context;
var canvas = ctx.canvas;

var fold = this.get("fold");
var w = canvas.width;
var h = canvas.height;

ctx.save();
ctx.shadowColor = "rgba(0,0,0,0.3)";
ctx.shadowBlur = 8;
Expand All @@ -93,7 +89,7 @@ ol_filter_Fold.prototype.postcompose = function(e)
ctx.save();
this.drawLine_(ctx, this.get("fsize"), this.get("margin"));
ctx.clip();

var fold = this.get("fold");
var w = canvas.width/fold[0];
var h = canvas.height/fold[1];
Expand Down