@sswroom/sswr 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/media.d.ts CHANGED
@@ -98,7 +98,7 @@ export class EXIFData
98
98
  parseMakerNote(buff: ArrayBuffer): EXIFData | null;
99
99
 
100
100
  static getEXIFName(exifMaker: EXIFMaker, id: number, subId: number): string;
101
- static parseIFD(reader: data.ByteReader, ofst: number, lsb: boolean, nextOfst: object, readBase: number, maker?: EXIFMaker): EXIFData | null;
101
+ static parseIFD(reader: data.ByteReader, ofst: number, lsb: boolean, nextOfst: object | null, readBase: number | null, maker?: EXIFMaker): EXIFData | null;
102
102
  }
103
103
 
104
104
  export class StaticImage extends data.ParsedObject
package/media.js CHANGED
@@ -1359,7 +1359,7 @@ export class EXIFData
1359
1359
  getPhotoDate()
1360
1360
  {
1361
1361
  let item;
1362
- if (this.exifMaker == EM_STANDARD)
1362
+ if (this.exifMaker == EXIFMaker.Standard)
1363
1363
  {
1364
1364
  if ((item = this.exifMap[36867]))
1365
1365
  {
@@ -1386,7 +1386,7 @@ export class EXIFData
1386
1386
  }
1387
1387
  if ((item = this.exifMap[306]))
1388
1388
  {
1389
- if (item.type == ET_STRING)
1389
+ if (item.type == EXIFType.STRING)
1390
1390
  {
1391
1391
  return data.Timestamp.fromStr(item.data, data.DateTimeUtil.getLocalTzQhr());
1392
1392
  }
@@ -1605,7 +1605,7 @@ export class EXIFData
1605
1605
  {
1606
1606
  return null;
1607
1607
  }
1608
- ret.lat = va;
1608
+ ret.lat = val;
1609
1609
  }
1610
1610
  else
1611
1611
  {
@@ -1715,7 +1715,7 @@ export class EXIFData
1715
1715
  {
1716
1716
  hh = item1.data[0];
1717
1717
  mm = item1.data[2];
1718
- val = item1.data[4] / item.data[5];
1718
+ val = item1.data[4] / item1.data[5];
1719
1719
  ss = Math.floor(val);
1720
1720
  ms = (val - ss);
1721
1721
  }
@@ -1933,6 +1933,14 @@ export class EXIFData
1933
1933
  return name || ("Tag "+subId);
1934
1934
  }
1935
1935
 
1936
+ /**
1937
+ * @param {data.ByteReader} reader
1938
+ * @param {number} ofst
1939
+ * @param {boolean} lsb
1940
+ * @param {object | null} nextOfst
1941
+ * @param {number | null} readBase
1942
+ * @param {string | null | undefined} [maker]
1943
+ */
1936
1944
  static parseIFD(reader, ofst, lsb, nextOfst, readBase, maker)
1937
1945
  {
1938
1946
  if (!(reader instanceof data.ByteReader))
@@ -2165,7 +2173,7 @@ export class EXIFData
2165
2173
  case 8:
2166
2174
  if (fcnt <= 2)
2167
2175
  {
2168
- exif.addInt16(tag, reader.readInt16Arr(ifdOfst + 8, fcnt));
2176
+ exif.addInt16(tag, reader.readInt16Arr(ifdOfst + 8, lsb, fcnt));
2169
2177
  }
2170
2178
  else
2171
2179
  {
@@ -2175,7 +2183,7 @@ export class EXIFData
2175
2183
  case 9:
2176
2184
  if (fcnt == 1)
2177
2185
  {
2178
- exif.addInt32(tag, reader.readInt32Arr(ifdOfst + 8, fcnt));
2186
+ exif.addInt32(tag, reader.readInt32Arr(ifdOfst + 8, lsb, fcnt));
2179
2187
  }
2180
2188
  else
2181
2189
  {
@@ -2190,7 +2198,6 @@ export class EXIFData
2190
2198
  break;
2191
2199
  default:
2192
2200
  console.log("EXIFData.parseIFD: Unsupported field type: "+ftype+", tag = "+tag);
2193
- j = 0;
2194
2201
  break;
2195
2202
  }
2196
2203
 
@@ -2243,8 +2250,12 @@ export class StaticImage extends data.ParsedObject
2243
2250
  canvas.width = this.img.naturalWidth;
2244
2251
  canvas.height = this.img.naturalHeight;
2245
2252
  let ctx = canvas.getContext("2d");
2246
- ctx.drawImage(this.img, 0, 0, this.img.naturalWidth, this.img.naturalHeight);
2247
- return canvas;
2253
+ if (ctx)
2254
+ {
2255
+ ctx.drawImage(this.img, 0, 0, this.img.naturalWidth, this.img.naturalHeight);
2256
+ return canvas;
2257
+ }
2258
+ throw new Error("Error in creating canvas");
2248
2259
  }
2249
2260
 
2250
2261
  exportJPG(quality)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sswroom/sswr",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "Libraries made by sswroom",
5
5
  "main": "sswr.js",
6
6
  "scripts": {
package/parser.js CHANGED
@@ -149,7 +149,7 @@ function parseKMLStyle(node)
149
149
  break;
150
150
  }
151
151
  }
152
- style.setLineStyle(innerStyle);
152
+ style.setLabelStyle(innerStyle);
153
153
  break;
154
154
  case "PolyStyle":
155
155
  innerStyle = new kml.PolyStyle();
@@ -342,6 +342,8 @@ function parseKMLContainer(container, kmlNode, doc)
342
342
  break;
343
343
  case "#text":
344
344
  break;
345
+ case "Schema":
346
+ break;
345
347
  default:
346
348
  console.log("Unknown node in kml container: "+node.nodeName, node);
347
349
  break;
@@ -549,7 +551,7 @@ function parseKMLGeometry(kmlNode)
549
551
  break;
550
552
  case "LinearRing":
551
553
  geom = parseKMLGeometry(subNode2);
552
- if (geom)
554
+ if (geom && (geom instanceof geometry.LinearRing))
553
555
  geomList.push(geom);
554
556
  break;
555
557
  default:
@@ -601,7 +603,22 @@ function parseKMLGeometry(kmlNode)
601
603
  geom = new geometry.MultiPolygon(4326);
602
604
  for (i in geomList)
603
605
  {
604
- geom.geometries.push(geomList[i]);
606
+ let g = geomList[i];
607
+ if (g instanceof geometry.Polygon)
608
+ {
609
+ geom.geometries.push(g);
610
+ }
611
+ }
612
+ return geom;
613
+ }
614
+ else if (geomList[0] instanceof geometry.LineString && (geomList.length == 1 || geomList[1] instanceof geometry.LineString))
615
+ {
616
+ geom = new geometry.Polyline(4326);
617
+ for (i in geomList)
618
+ {
619
+ let g = geomList[i];
620
+ if (g instanceof geometry.LineString)
621
+ geom.geometries.push(g);
605
622
  }
606
623
  return geom;
607
624
  }
@@ -1140,14 +1157,18 @@ function parseX509(reader, fileName, mime)
1140
1157
  }
1141
1158
  else if (files.length > 1)
1142
1159
  {
1143
- let fileList = new cert.X509FileList(fileName, files[0]);
1144
- let i = 1;
1145
- while (i < files.length)
1160
+ let f = files[0];
1161
+ if (f instanceof cert.X509Cert)
1146
1162
  {
1147
- fileList.addFile(files[i]);
1148
- i++;
1163
+ let fileList = new cert.X509FileList(fileName, f);
1164
+ let i = 1;
1165
+ while (i < files.length)
1166
+ {
1167
+ fileList.addFile(files[i]);
1168
+ i++;
1169
+ }
1170
+ return fileList;
1149
1171
  }
1150
- return fileList;
1151
1172
  }
1152
1173
  console.log("Unsupported file", fileName, mime);
1153
1174
  }
package/text.d.ts CHANGED
@@ -24,7 +24,7 @@ export function arrayToNumbers(arr: string[]): number[];
24
24
  export function toHex8(v: number): string;
25
25
  export function toHex16(v: number): string;
26
26
  export function toHex32(v: number): string;
27
- export function u8Arr2Hex(buff: Uint8Array, byteSep: string, rowSep: string): string;
27
+ export function u8Arr2Hex(buff: Uint8Array, byteSep: string | null, rowSep: string | null): string;
28
28
  export function splitLines(txt: string): string[];
29
29
  export function isEmailAddress(s: string): boolean;
30
30
  export function toUTF32Length(s: string): number;
package/text.js CHANGED
@@ -916,7 +916,7 @@ export class Base64Enc extends TextBinEnc
916
916
  let i = 0;
917
917
  let j = str.length;
918
918
  let b = 0;
919
- let b2;
919
+ let b2 = 0;
920
920
  let c;
921
921
  let code;
922
922
  while (i < j)
@@ -1182,7 +1182,7 @@ export class CPPTextBinEnc extends TextBinEnc
1182
1182
  }
1183
1183
  else if ((b & 0xfe) == 0xfc)
1184
1184
  {
1185
- code = (UInt32)(((b & 0x1) << 30) | ((arr[i + 1] & 0x3f) << 24) | ((arr[i + 2] & 0x3f) << 18) | ((arr[i + 3] & 0x3f) << 12) | ((arr[i + 4] & 0x3f) << 6) | (arr[i + 5] & 0x3f));
1185
+ code = (((b & 0x1) << 30) | ((arr[i + 1] & 0x3f) << 24) | ((arr[i + 2] & 0x3f) << 18) | ((arr[i + 3] & 0x3f) << 12) | ((arr[i + 4] & 0x3f) << 6) | (arr[i + 5] & 0x3f));
1186
1186
  if (code >= 0x10000)
1187
1187
  {
1188
1188
  ret.push(String.fromCharCode(((code - 0x10000) >> 10) + 0xd800, (code & 0x3ff) + 0xdc00));