Added (svg) type
This commit is contained in:
@@ -132,6 +132,10 @@ function Library (ronin) {
|
||||
return { a, b, t }
|
||||
}
|
||||
|
||||
this.svg = (d, t = 'svg') => {
|
||||
return { d, t }
|
||||
}
|
||||
|
||||
this.text = (x, y, g, s, f = 'Arial', t = 'text') => {
|
||||
return { x, y, g, s, f, t }
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ function Surface (ronin) {
|
||||
if (shape.t === 'text') {
|
||||
context.font = `${shape.g}px ${shape.f}`
|
||||
context.strokeText(shape.s, shape.x, shape.y)
|
||||
} else if (shape.t === 'svg') {
|
||||
context.lineWidth = width
|
||||
context.strokeStyle = color
|
||||
context.stroke(new Path2D(shape.d))
|
||||
} else {
|
||||
context.stroke()
|
||||
}
|
||||
@@ -59,6 +63,10 @@ function Surface (ronin) {
|
||||
if (shape.t === 'text') {
|
||||
context.font = `${shape.g}px ${shape.f}`
|
||||
context.fillText(shape.s, shape.x, shape.y)
|
||||
} else if (shape.t === 'svg') {
|
||||
context.lineWidth = width
|
||||
context.fillStyle = color
|
||||
context.fill(new Path2D(shape.d))
|
||||
} else {
|
||||
context.fill()
|
||||
}
|
||||
@@ -76,6 +84,8 @@ function Surface (ronin) {
|
||||
this.traceCircle(shape, context)
|
||||
} else if (shape.t === 'text') {
|
||||
this.traceText(shape, context)
|
||||
} else if (shape.t === 'svg') {
|
||||
this.traceSVG(shape, context)
|
||||
} else {
|
||||
console.warn('Unknown type')
|
||||
}
|
||||
@@ -102,6 +112,10 @@ function Surface (ronin) {
|
||||
|
||||
}
|
||||
|
||||
this.traceSVG = function (text, context) {
|
||||
|
||||
}
|
||||
|
||||
// IO
|
||||
|
||||
this.open = function (path, scale) {
|
||||
|
||||
Reference in New Issue
Block a user