atr-components 0.2.305 → 0.2.306

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.
@@ -128,7 +128,6 @@ const transAnimation = animation([
128
128
  ]);
129
129
 
130
130
  const atr_static_datas = {
131
- test: '1',
132
131
  /**
133
132
  * oss地址前缀
134
133
  */
@@ -282,6 +281,51 @@ class ToolsUtil {
282
281
  static httpSucces(res) {
283
282
  return ['200', '201', '204'].some(v => res.status == v);
284
283
  }
284
+ /**
285
+ * 计算两点坐标距离
286
+ * @param point1
287
+ * @param point2
288
+ */
289
+ static getDistance(point1, point2) {
290
+ let distance = Math.sqrt((point2.x - point1.x) * (point2.x - point1.x) + (point2.y - point1.y) * (point2.y - point1.y));
291
+ return distance;
292
+ }
293
+ /**
294
+ * 判断线段是否相交,相交返回交点坐标
295
+ * @param p1
296
+ * @param p2
297
+ */
298
+ static checkIntersect(lineArr1, lineArr2) {
299
+ //解线性方程组求线段交点
300
+ //如果父母为0,则不需要计算交点 两线平行
301
+ let a = lineArr1[0], b = lineArr1[1], c = lineArr2[0], d = lineArr2[1];
302
+ a = { x: parseFloat(a.x.toFixed(2)), y: parseFloat(a.y.toFixed(2)) };
303
+ b = { x: parseFloat(b.x.toFixed(2)), y: parseFloat(b.y.toFixed(2)) };
304
+ c = { x: parseFloat(c.x.toFixed(2)), y: parseFloat(c.y.toFixed(2)) };
305
+ d = { x: parseFloat(d.x.toFixed(2)), y: parseFloat(d.y.toFixed(2)) };
306
+ console.log((b.y - a.y));
307
+ console.log((d.x - c.x));
308
+ console.log((a.x - b.x));
309
+ console.log((c.y - d.y));
310
+ let denominator = (b.y - a.y) * (d.x - c.x) - (a.x - b.x) * (c.y - d.y);
311
+ if (denominator == 0) {
312
+ return false;
313
+ }
314
+ let x = ((b.x - a.x) * (d.x - c.x) * (c.y - a.y)
315
+ + (b.y - a.y) * (d.x - c.x) * a.x
316
+ - (d.y - c.y) * (b.x - a.x) * c.x) / denominator, y = -((b.y - a.y) * (d.y - c.y) * (c.x - a.x)
317
+ + (b.x - a.x) * (d.y - c.y) * a.y
318
+ - (d.x - c.x) * (b.y - a.y) * c.y) / denominator;
319
+ //判断交点是否在两条线段上
320
+ if (
321
+ //交点在线段1
322
+ (x - a.x) * (x - b.x) <= 0 && (y - a.y) * (y - b.y) <= 0 &&
323
+ //并且交点在线段2上
324
+ (x - c.x) * (x - d.x) <= 0 && (y - c.y) * (y - d.y) <= 0) {
325
+ return { x: x, y: y };
326
+ }
327
+ return false;
328
+ }
285
329
  /**
286
330
  *判断点是否在坐标区域内
287
331
  * @param p 判定的点
@@ -342,6 +386,9 @@ class ToolsUtil {
342
386
  action();
343
387
  }
344
388
  }
389
+ static deepCopy(obj) {
390
+ return JSON.parse(JSON.stringify(obj));
391
+ }
345
392
  static diffInputs(chng, action) {
346
393
  if (chng === undefined)
347
394
  return;
@@ -2249,16 +2296,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
2249
2296
 
2250
2297
  class HelloComponent {
2251
2298
  constructor() {
2252
- this.test = atr_static_datas.test;
2253
2299
  }
2254
2300
  ngOnInit() {
2255
2301
  }
2256
2302
  }
2257
2303
  HelloComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HelloComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2258
- HelloComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: HelloComponent, selector: "atr-hello", ngImport: i0, template: "<p>hello works!</p>\n<p>\u6D4B\u8BD5:{{test}}</p>\n", styles: [""] });
2304
+ HelloComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: HelloComponent, selector: "atr-hello", ngImport: i0, template: "<p>hello works!</p>\n", styles: [""] });
2259
2305
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HelloComponent, decorators: [{
2260
2306
  type: Component,
2261
- args: [{ selector: 'atr-hello', template: "<p>hello works!</p>\n<p>\u6D4B\u8BD5:{{test}}</p>\n", styles: [""] }]
2307
+ args: [{ selector: 'atr-hello', template: "<p>hello works!</p>\n", styles: [""] }]
2262
2308
  }], ctorParameters: function () { return []; } });
2263
2309
 
2264
2310
  class HelloModule {