atr-components 0.2.238 → 0.2.240
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/esm2020/core/utils/ToolsUtil.mjs +4 -4
- package/esm2020/lib/shared/img-canvas/img-canvas.component.mjs +11 -17
- package/fesm2015/atr-components.mjs +12 -17
- package/fesm2015/atr-components.mjs.map +1 -1
- package/fesm2020/atr-components.mjs +12 -17
- package/fesm2020/atr-components.mjs.map +1 -1
- package/lib/shared/img-canvas/img-canvas.component.d.ts +4 -2
- package/package.json +1 -1
|
@@ -216,7 +216,7 @@ class ToolsUtil {
|
|
|
216
216
|
* @param pointsArr
|
|
217
217
|
*/
|
|
218
218
|
static judgeInRec(p, pointsArr) {
|
|
219
|
-
let px = p.x1, py = p.y1, flag = false, //穿越边框
|
|
219
|
+
let px = Number(p.x1), py = Number(p.y1), flag = false, //穿越边框
|
|
220
220
|
inRect = false; //是否在多边形的边或者端点上
|
|
221
221
|
let start = pointsArr[0];
|
|
222
222
|
let end = pointsArr[pointsArr.length - 1];
|
|
@@ -230,7 +230,7 @@ class ToolsUtil {
|
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
let endPoint = pointsArr[index + 1];
|
|
233
|
-
const startX = item.x1, startY = item.y1, endX = endPoint.x1, endY = endPoint.y1;
|
|
233
|
+
const startX = Number(item.x1), startY = Number(item.y1), endX = Number(endPoint.x1), endY = Number(endPoint.y1);
|
|
234
234
|
//判断点是否在端点上
|
|
235
235
|
if ((px == startX && py == startY)
|
|
236
236
|
|| (px == endX && px == endY)) {
|
|
@@ -238,7 +238,7 @@ class ToolsUtil {
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
//判断射线重合并且点在边上
|
|
241
|
-
if ((startY == endY == py)
|
|
241
|
+
if ((startY == endY && endY == py)
|
|
242
242
|
&& ((px > endX && px < startX
|
|
243
243
|
|| (px < endX && px > startX)))) {
|
|
244
244
|
inRect = true;
|
|
@@ -4766,6 +4766,8 @@ class ImgCanvasComponent {
|
|
|
4766
4766
|
this.width = 800;
|
|
4767
4767
|
this.height = 800;
|
|
4768
4768
|
this.clipArr = [];
|
|
4769
|
+
this.rotateNum = 0;
|
|
4770
|
+
this.loadOver = new EventEmitter();
|
|
4769
4771
|
}
|
|
4770
4772
|
set url(url) {
|
|
4771
4773
|
if (url && url.indexOf('?v=') < 0) {
|
|
@@ -4816,7 +4818,6 @@ class ImgCanvasComponent {
|
|
|
4816
4818
|
};
|
|
4817
4819
|
}
|
|
4818
4820
|
initImg(needSession = true) {
|
|
4819
|
-
let obj = SessionStorageUtil.get('appImg');
|
|
4820
4821
|
this.canvasDom = this.canvas1.nativeElement;
|
|
4821
4822
|
// this.canvasDom = document.getElementById(this.canvasId);
|
|
4822
4823
|
//检测支持性
|
|
@@ -4825,23 +4826,13 @@ class ImgCanvasComponent {
|
|
|
4825
4826
|
//获得 2d 上下文对象
|
|
4826
4827
|
let context1 = this.canvasDom.getContext('2d');
|
|
4827
4828
|
let image = this.imgUrl;
|
|
4828
|
-
// if (obj && needSession && obj[image]) {
|
|
4829
|
-
// //图片缓存在session中
|
|
4830
|
-
// this.img = obj[image]
|
|
4831
|
-
// this.initBase(context1)
|
|
4832
|
-
// return;
|
|
4833
|
-
// }
|
|
4834
|
-
if (!obj) {
|
|
4835
|
-
obj = {};
|
|
4836
|
-
}
|
|
4837
4829
|
this.img = new Image(); //创建img元素
|
|
4838
4830
|
this.img.setAttribute('crossOrigin', 'anonymous');
|
|
4839
4831
|
this.img.src = this.imgUrl; //设置图片源地址
|
|
4840
4832
|
// this.img.src = ToolsUtil.getOssUrl(this.imgUrl);//设置图片源地址
|
|
4841
4833
|
this.img.onload = () => {
|
|
4842
|
-
obj[image] = this.img;
|
|
4843
|
-
SessionStorageUtil.put('appImg', obj);
|
|
4844
4834
|
this.initBase(context1);
|
|
4835
|
+
this.loadOver.emit({ code: 'loadOver' });
|
|
4845
4836
|
};
|
|
4846
4837
|
}
|
|
4847
4838
|
initBase(context1) {
|
|
@@ -4876,10 +4867,10 @@ class ImgCanvasComponent {
|
|
|
4876
4867
|
}
|
|
4877
4868
|
}
|
|
4878
4869
|
ImgCanvasComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ImgCanvasComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4879
|
-
ImgCanvasComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ImgCanvasComponent, selector: "app-img", inputs: { url: "url", clipArr: "clipArr" }, viewQueries: [{ propertyName: "canvas1", first: true, predicate: ["canvas1"], descendants: true }], ngImport: i0, template: "<canvas #canvas1 style=\"width: 100%;height: 100
|
|
4870
|
+
ImgCanvasComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ImgCanvasComponent, selector: "app-img", inputs: { url: "url", clipArr: "clipArr", rotateNum: "rotateNum" }, outputs: { loadOver: "loadOver" }, viewQueries: [{ propertyName: "canvas1", first: true, predicate: ["canvas1"], descendants: true }], ngImport: i0, template: "<canvas #canvas1 style=\"width: 100%;height: 100%;\">\n \u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u753B\u5E03\uFF01\n</canvas>\n<ng-content></ng-content>\n", styles: [""] });
|
|
4880
4871
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ImgCanvasComponent, decorators: [{
|
|
4881
4872
|
type: Component,
|
|
4882
|
-
args: [{ selector: 'app-img', template: "<canvas #canvas1 style=\"width: 100%;height: 100
|
|
4873
|
+
args: [{ selector: 'app-img', template: "<canvas #canvas1 style=\"width: 100%;height: 100%;\">\n \u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u753B\u5E03\uFF01\n</canvas>\n<ng-content></ng-content>\n", styles: [""] }]
|
|
4883
4874
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { url: [{
|
|
4884
4875
|
type: Input
|
|
4885
4876
|
}], canvas1: [{
|
|
@@ -4887,6 +4878,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
4887
4878
|
args: ['canvas1', { static: false }]
|
|
4888
4879
|
}], clipArr: [{
|
|
4889
4880
|
type: Input
|
|
4881
|
+
}], rotateNum: [{
|
|
4882
|
+
type: Input
|
|
4883
|
+
}], loadOver: [{
|
|
4884
|
+
type: Output
|
|
4890
4885
|
}] } });
|
|
4891
4886
|
|
|
4892
4887
|
const THIRDMODULES = [
|