fix: javascript in chromium

This commit is contained in:
King Kévin 2015-09-09 12:58:21 +02:00
parent f9126f781f
commit d5723c2597
1 changed files with 8 additions and 8 deletions

View File

@ -42,7 +42,7 @@ function cvlp_arc(x, y, radius, start, angle, thickness) {
}
// create a set of elements with an pad element
function cvlp_pad(number, x, y, width, height, round=true) {
function cvlp_pad(number, x, y, width, height, round) {
var pad = {}
pad.type = "pad"
pad.number = number
@ -50,12 +50,12 @@ function cvlp_pad(number, x, y, width, height, round=true) {
pad.y = y
pad.width = width
pad.height = height
pad.round = round
pad.round = round || true
return [pad]
}
// create a set of elements with an pin element
function cvlp_pin(number, x, y, thickness, drill, round=true) {
function cvlp_pin(number, x, y, thickness, drill, round) {
var pin = {}
pin.type = "pin"
pin.number = number
@ -63,18 +63,18 @@ function cvlp_pin(number, x, y, thickness, drill, round=true) {
pin.y = y
pin.thickness = thickness
pin.drill = drill
pin.round = round
pin.round = round || true
return [pin]
}
// create a set of elements representing a chain of lines
// provide a list of [x,y] coordinates
function cvlp_polyline(points, thickness, closed=false) {
function cvlp_polyline(points, thickness, closed) {
var polyline = []
for (var i=0; i<points.length-1; i++) {
polyline = polyline.concat(cvlp_line(points[i][0], points[i][1], points[i+1][0], points[i+1][1], thickness))
}
if (closed) {
if (closed || false) {
if (points[0][0]!=points[points.length-1][0] && points[0][1]!=points[points.length-1][1]) {
polyline = polyline.concat(cvlp_line(points[points.length-1][0], points[points.length-1][1], points[0][0], points[0][1], thickness))
}
@ -84,13 +84,13 @@ function cvlp_polyline(points, thickness, closed=false) {
// create a set of elements representing a rectangle
// provide top corner, size, an radius of corner
function cvlp_rectangle(x, y, width, height, thickness, radius=0) {
function cvlp_rectangle(x, y, width, height, thickness, radius) {
var rectangle = []
rectangle = rectangle.concat(cvlp_line(x+radius, y, x+width-radius, y, thickness))
rectangle = rectangle.concat(cvlp_line(x+width, y+radius, x+width, y+height-radius, thickness))
rectangle = rectangle.concat(cvlp_line(x+width-radius, y+height, x+radius, y+height, thickness))
rectangle = rectangle.concat(cvlp_line(x, y+height-radius, x, y+radius, thickness))
if (radius!=0) {
if (radius !== 'undefined' && radius!=0) {
rectangle = rectangle.concat(cvlp_arc(x+radius, y+radius, radius, 180, 90, thickness))
rectangle = rectangle.concat(cvlp_arc(x+width-radius, y+radius, radius, 270, 90, thickness))
rectangle = rectangle.concat(cvlp_arc(x+width-radius, y+width-radius, radius, 0, 90, thickness))