Comparing version 1.1.0 to 1.1.1
@@ -22,4 +22,5 @@ import { Surface } from './Surface'; | ||
asciiContainer: HTMLDivElement; | ||
asciiPalette: PaletteItem[][]; | ||
static asciiPalette: PaletteItem[][]; | ||
constructor(opts: AsciiSurfaceParams); | ||
destroy(): void; | ||
clear(): void; | ||
@@ -26,0 +27,0 @@ polygon(points: Vector3[], color: Color): void; |
@@ -33,4 +33,2 @@ import { CanvasSurface } from './CanvasSurface'; | ||
g.fillText(char, i * fontSize + fontSize * 0.5, fontSize * 0.5); | ||
// g.fillStyle = 'red' | ||
// g.strokeRect(i * fontSize, 0, fontSize, fontSize) | ||
} | ||
@@ -78,3 +76,5 @@ var charL = function (i) { | ||
this.container = opts.container; | ||
this.asciiPalette = createAsciiPalette(); | ||
if (!AsciiSurface.asciiPalette) { | ||
AsciiSurface.asciiPalette = createAsciiPalette(); | ||
} | ||
this.asciiContainer = document.createElement('div'); | ||
@@ -91,2 +91,5 @@ var style = [ | ||
} | ||
AsciiSurface.prototype.destroy = function () { | ||
this.container.removeChild(this.asciiContainer); | ||
}; | ||
AsciiSurface.prototype.clear = function () { | ||
@@ -102,3 +105,3 @@ this.canvasSurface.clear(); | ||
AsciiSurface.prototype.render = function () { | ||
var palette = this.asciiPalette; | ||
var palette = AsciiSurface.asciiPalette; | ||
var imageData = this.canvasSurface.getImageData(); | ||
@@ -105,0 +108,0 @@ var i = 0; |
@@ -16,2 +16,3 @@ import { Surface } from './Surface'; | ||
constructor(opts: CanvasSurfaceParameters); | ||
destroy(): void; | ||
createEl(name: string, attrs: { | ||
@@ -18,0 +19,0 @@ [id: string]: string; |
@@ -18,2 +18,5 @@ var CanvasSurface = /** @class */ (function () { | ||
} | ||
CanvasSurface.prototype.destroy = function () { | ||
this.container.removeChild(this.canvas); | ||
}; | ||
CanvasSurface.prototype.createEl = function (name, attrs) { | ||
@@ -20,0 +23,0 @@ var el = document.createElement(name); |
@@ -11,3 +11,4 @@ import { Vector3 } from '../math/Vector3'; | ||
render(): void; | ||
destroy(): void; | ||
} | ||
export {}; |
@@ -5,3 +5,3 @@ import { Surface } from './Surface'; | ||
declare type SvgSurfaceParameters = { | ||
container: string | HTMLElement; | ||
container: HTMLElement; | ||
width?: number; | ||
@@ -17,2 +17,3 @@ height?: number; | ||
constructor(opts: SvgSurfaceParameters); | ||
destroy(): void; | ||
createEl(name: string, attrs: { | ||
@@ -19,0 +20,0 @@ [id: string]: string; |
@@ -13,5 +13,3 @@ var SVG_NS = 'http://www.w3.org/2000/svg'; | ||
this.setAttrNS(svg, XML_NS, 'xmlns:xlink', 'http://www.w3.org/1999/xlink'); | ||
var container = typeof opts.container === 'string' | ||
? document.getElementById(opts.container) | ||
: opts.container; | ||
var container = opts.container; | ||
container.appendChild(svg); | ||
@@ -21,2 +19,5 @@ this.container = container; | ||
} | ||
SvgSurface.prototype.destroy = function () { | ||
this.container.removeChild(this.container); | ||
}; | ||
SvgSurface.prototype.createEl = function (name, attrs) { | ||
@@ -23,0 +24,0 @@ var el = document.createElementNS(SVG_NS, name); |
{ | ||
"name": "polygonts", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "dist/index.js", | ||
@@ -14,9 +14,9 @@ "types": "dist/index.d.ts", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"@types/jest": "^25.1.2", | ||
"@types/node": "^13.7.1", | ||
"@types/jest": "^25.1.3", | ||
"@types/node": "^13.7.7", | ||
"jest": "^25.1.0", | ||
"prettier": "^1.19.1", | ||
"typescript": "^3.7.5" | ||
"typescript": "^3.8.3" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -43,5 +43,2 @@ import { Surface } from './Surface' | ||
g.fillText(char, i * fontSize + fontSize * 0.5, fontSize * 0.5) | ||
// g.fillStyle = 'red' | ||
// g.strokeRect(i * fontSize, 0, fontSize, fontSize) | ||
} | ||
@@ -101,3 +98,3 @@ | ||
asciiContainer: HTMLDivElement | ||
asciiPalette: PaletteItem[][] | ||
static asciiPalette: PaletteItem[][] | ||
@@ -116,3 +113,5 @@ constructor(opts: AsciiSurfaceParams) { | ||
this.container = opts.container | ||
this.asciiPalette = createAsciiPalette() | ||
if (!AsciiSurface.asciiPalette) { | ||
AsciiSurface.asciiPalette = createAsciiPalette() | ||
} | ||
@@ -133,2 +132,6 @@ this.asciiContainer = document.createElement('div') | ||
destroy() { | ||
this.container.removeChild(this.asciiContainer) | ||
} | ||
clear(): void { | ||
@@ -147,3 +150,3 @@ this.canvasSurface.clear() | ||
render(): void { | ||
const palette = this.asciiPalette | ||
const palette = AsciiSurface.asciiPalette | ||
const imageData = this.canvasSurface.getImageData() | ||
@@ -150,0 +153,0 @@ let i = 0 |
@@ -42,2 +42,6 @@ import { Surface } from './Surface' | ||
destroy() { | ||
this.container.removeChild(this.canvas) | ||
} | ||
createEl(name: string, attrs: { [id: string]: string }): HTMLElement { | ||
@@ -44,0 +48,0 @@ const el = document.createElement(name) |
@@ -14,2 +14,3 @@ import { Vector3 } from '../math/Vector3' | ||
render(): void | ||
destroy(): void | ||
} |
@@ -7,3 +7,3 @@ import { Surface } from './Surface' | ||
type SvgSurfaceParameters = { | ||
container: string | HTMLElement | ||
container: HTMLElement | ||
width?: number | ||
@@ -36,6 +36,3 @@ height?: number | ||
const container = | ||
typeof opts.container === 'string' | ||
? document.getElementById(opts.container) | ||
: opts.container | ||
const container = opts.container | ||
@@ -47,2 +44,6 @@ container.appendChild(svg) | ||
destroy() { | ||
this.container.removeChild(this.container) | ||
} | ||
createEl(name: string, attrs: { [id: string]: string }): SVGSVGElement { | ||
@@ -49,0 +50,0 @@ const el = document.createElementNS(SVG_NS, name) as SVGSVGElement |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
461749
5063