hellfire 0.20.0 → 0.20.1
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/CHANGELOG.md +4 -0
- package/dist/index.js +88 -122
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.20.1](http://10.16.100.57/diffusion/115/paladin/compare/v0.20.0...v0.20.1) (2022-05-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
# [0.20.0](http://10.16.100.57/diffusion/115/paladin/compare/v0.19.9...v0.20.0) (2022-05-10)
|
|
6
10
|
|
|
7
11
|
|
package/dist/index.js
CHANGED
|
@@ -54497,71 +54497,22 @@ var __signature__$3k = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoa
|
|
|
54497
54497
|
return a;
|
|
54498
54498
|
};
|
|
54499
54499
|
var domId = "paladinOutputMock";
|
|
54500
|
+
var actionPool = {};
|
|
54501
|
+
var currentActionIndex = 0;
|
|
54500
54502
|
|
|
54501
|
-
function
|
|
54502
|
-
var
|
|
54503
|
+
function getMultiImageDataFromWodo(_ref) {
|
|
54504
|
+
var wodoList = _ref.wodoList,
|
|
54503
54505
|
_ref$width = _ref.width,
|
|
54504
54506
|
width = _ref$width === void 0 ? 100 : _ref$width,
|
|
54505
54507
|
_ref$height = _ref.height,
|
|
54506
|
-
height = _ref$height === void 0 ? 100 : _ref$height
|
|
54508
|
+
height = _ref$height === void 0 ? 100 : _ref$height,
|
|
54509
|
+
token = _ref.token;
|
|
54507
54510
|
return new Promise( /*#__PURE__*/function () {
|
|
54508
54511
|
var _ref2 = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
54509
|
-
var
|
|
54512
|
+
var i;
|
|
54510
54513
|
return regenerator.wrap(function _callee$(_context) {
|
|
54511
54514
|
while (1) {
|
|
54512
54515
|
switch (_context.prev = _context.next) {
|
|
54513
|
-
case 0:
|
|
54514
|
-
if (!wodo) {
|
|
54515
|
-
reject('wodo必填');
|
|
54516
|
-
}
|
|
54517
|
-
|
|
54518
|
-
if (!lodash$1.isNumber(width) || !lodash$1.isNumber(height)) {
|
|
54519
|
-
reject('width、height应为number类型');
|
|
54520
|
-
}
|
|
54521
|
-
|
|
54522
|
-
_context.prev = 2;
|
|
54523
|
-
_context.next = 5;
|
|
54524
|
-
return getImage(wodo, width, height);
|
|
54525
|
-
|
|
54526
|
-
case 5:
|
|
54527
|
-
img = _context.sent;
|
|
54528
|
-
removeDom();
|
|
54529
|
-
resolve(img);
|
|
54530
|
-
_context.next = 14;
|
|
54531
|
-
break;
|
|
54532
|
-
|
|
54533
|
-
case 10:
|
|
54534
|
-
_context.prev = 10;
|
|
54535
|
-
_context.t0 = _context["catch"](2);
|
|
54536
|
-
removeDom();
|
|
54537
|
-
reject();
|
|
54538
|
-
|
|
54539
|
-
case 14:
|
|
54540
|
-
case "end":
|
|
54541
|
-
return _context.stop();
|
|
54542
|
-
}
|
|
54543
|
-
}
|
|
54544
|
-
}, _callee, null, [[2, 10]]);
|
|
54545
|
-
}));
|
|
54546
|
-
|
|
54547
|
-
return function (_x, _x2) {
|
|
54548
|
-
return _ref2.apply(this, arguments);
|
|
54549
|
-
};
|
|
54550
|
-
}());
|
|
54551
|
-
}
|
|
54552
|
-
|
|
54553
|
-
function getMultiImageDataFromWodo(_ref3) {
|
|
54554
|
-
var wodoList = _ref3.wodoList,
|
|
54555
|
-
_ref3$width = _ref3.width,
|
|
54556
|
-
width = _ref3$width === void 0 ? 100 : _ref3$width,
|
|
54557
|
-
_ref3$height = _ref3.height,
|
|
54558
|
-
height = _ref3$height === void 0 ? 100 : _ref3$height;
|
|
54559
|
-
return new Promise( /*#__PURE__*/function () {
|
|
54560
|
-
var _ref4 = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(resolve, reject) {
|
|
54561
|
-
var result, i, img;
|
|
54562
|
-
return regenerator.wrap(function _callee2$(_context2) {
|
|
54563
|
-
while (1) {
|
|
54564
|
-
switch (_context2.prev = _context2.next) {
|
|
54565
54516
|
case 0:
|
|
54566
54517
|
if (!wodoList || wodoList.length === 0) {
|
|
54567
54518
|
reject('wodoList必填');
|
|
@@ -54571,88 +54522,102 @@ function getMultiImageDataFromWodo(_ref3) {
|
|
|
54571
54522
|
reject('width、height应为number类型');
|
|
54572
54523
|
}
|
|
54573
54524
|
|
|
54574
|
-
|
|
54575
|
-
|
|
54576
|
-
|
|
54525
|
+
if (!token) {
|
|
54526
|
+
reject('token必填');
|
|
54527
|
+
} // token
|
|
54577
54528
|
|
|
54578
|
-
case 5:
|
|
54579
|
-
if (!(i < wodoList.length)) {
|
|
54580
|
-
_context2.next = 13;
|
|
54581
|
-
break;
|
|
54582
|
-
}
|
|
54583
54529
|
|
|
54584
|
-
|
|
54585
|
-
|
|
54586
|
-
|
|
54587
|
-
|
|
54588
|
-
|
|
54589
|
-
result.push(img);
|
|
54530
|
+
cornerstoneWADOImageLoader.configure({
|
|
54531
|
+
beforeSend: function beforeSend(xhr) {
|
|
54532
|
+
xhr.setRequestHeader('Authorization', "bearer ".concat(token));
|
|
54533
|
+
}
|
|
54534
|
+
});
|
|
54590
54535
|
|
|
54591
|
-
|
|
54592
|
-
|
|
54593
|
-
|
|
54594
|
-
|
|
54536
|
+
try {
|
|
54537
|
+
actionPool[currentActionIndex] = {
|
|
54538
|
+
total: wodoList.length,
|
|
54539
|
+
resultResolve: resolve,
|
|
54540
|
+
result: [],
|
|
54541
|
+
element: []
|
|
54542
|
+
};
|
|
54595
54543
|
|
|
54596
|
-
|
|
54597
|
-
|
|
54598
|
-
|
|
54599
|
-
_context2.next = 21;
|
|
54600
|
-
break;
|
|
54544
|
+
for (i = 0; i < wodoList.length; i++) {
|
|
54545
|
+
getImage(wodoList[i], width, height, currentActionIndex, i);
|
|
54546
|
+
}
|
|
54601
54547
|
|
|
54602
|
-
|
|
54603
|
-
|
|
54604
|
-
|
|
54605
|
-
|
|
54606
|
-
reject();
|
|
54548
|
+
currentActionIndex++;
|
|
54549
|
+
} catch (e) {
|
|
54550
|
+
reject();
|
|
54551
|
+
}
|
|
54607
54552
|
|
|
54608
|
-
case
|
|
54553
|
+
case 5:
|
|
54609
54554
|
case "end":
|
|
54610
|
-
return
|
|
54555
|
+
return _context.stop();
|
|
54611
54556
|
}
|
|
54612
54557
|
}
|
|
54613
|
-
},
|
|
54558
|
+
}, _callee);
|
|
54614
54559
|
}));
|
|
54615
54560
|
|
|
54616
|
-
return function (
|
|
54617
|
-
return
|
|
54561
|
+
return function (_x, _x2) {
|
|
54562
|
+
return _ref2.apply(this, arguments);
|
|
54618
54563
|
};
|
|
54619
54564
|
}());
|
|
54620
54565
|
}
|
|
54621
54566
|
|
|
54622
|
-
function getImage(wodo, width, height) {
|
|
54623
|
-
|
|
54624
|
-
|
|
54625
|
-
|
|
54626
|
-
|
|
54627
|
-
|
|
54628
|
-
|
|
54629
|
-
|
|
54630
|
-
|
|
54631
|
-
|
|
54632
|
-
|
|
54633
|
-
|
|
54634
|
-
|
|
54635
|
-
|
|
54636
|
-
|
|
54637
|
-
|
|
54638
|
-
|
|
54639
|
-
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
|
|
54643
|
-
|
|
54644
|
-
|
|
54645
|
-
cornerstone.reset(element);
|
|
54646
|
-
var img = canvas.toDataURL("image/jpeg", 1);
|
|
54647
|
-
resolve(img);
|
|
54648
|
-
}).catch(function (err) {
|
|
54649
|
-
reject(err);
|
|
54650
|
-
});
|
|
54567
|
+
function getImage(wodo, width, height, currentActionIndex, imageIndex) {
|
|
54568
|
+
cornerstone.loadAndCacheImage(wodo).then(function (image) {
|
|
54569
|
+
var id = "".concat(domId, "-").concat(currentActionIndex, "-").concat(imageIndex);
|
|
54570
|
+
var element = document.getElementById(id);
|
|
54571
|
+
var canvas;
|
|
54572
|
+
|
|
54573
|
+
if (!element) {
|
|
54574
|
+
element = document.createElement("div");
|
|
54575
|
+
element.setAttribute("id", id);
|
|
54576
|
+
document.body.appendChild(element);
|
|
54577
|
+
actionPool[currentActionIndex].element[imageIndex] = element;
|
|
54578
|
+
element.style.width = width + 'px';
|
|
54579
|
+
element.style.height = height + 'px';
|
|
54580
|
+
element.style.display = 'block';
|
|
54581
|
+
element.style.visibility = 'hidden';
|
|
54582
|
+
canvas = document.createElement("canvas");
|
|
54583
|
+
element.appendChild(canvas);
|
|
54584
|
+
canvas.setAttribute('class', 'cornerstone-canvas');
|
|
54585
|
+
cornerstone.enable(element, {});
|
|
54586
|
+
}
|
|
54587
|
+
|
|
54588
|
+
element.addEventListener(cornerstone.EVENTS.IMAGE_RENDERED, onImageRendered);
|
|
54589
|
+
cornerstone.displayImage(element, image);
|
|
54651
54590
|
});
|
|
54652
54591
|
}
|
|
54653
54592
|
|
|
54654
|
-
function
|
|
54655
|
-
var
|
|
54593
|
+
var onImageRendered = function onImageRendered(ev) {
|
|
54594
|
+
var element = ev.target;
|
|
54595
|
+
var img = cornerstone.getEnabledElement(element).canvas.toDataURL('image/png');
|
|
54596
|
+
var id = element.id;
|
|
54597
|
+
var currentActionIndex = id.split('-')[1];
|
|
54598
|
+
var imageIndex = id.split('-')[2];
|
|
54599
|
+
actionPool[currentActionIndex].result[imageIndex] = img;
|
|
54600
|
+
var result = actionPool[currentActionIndex].result;
|
|
54601
|
+
|
|
54602
|
+
if (result.length === actionPool[currentActionIndex].total) {
|
|
54603
|
+
var checkError = false;
|
|
54604
|
+
lodash$1.forEach(result, function (item) {
|
|
54605
|
+
if (!item) {
|
|
54606
|
+
checkError = true;
|
|
54607
|
+
}
|
|
54608
|
+
}); // 全部补全 resolve出去
|
|
54609
|
+
|
|
54610
|
+
if (!checkError) {
|
|
54611
|
+
actionPool[currentActionIndex].resultResolve(result);
|
|
54612
|
+
}
|
|
54613
|
+
}
|
|
54614
|
+
|
|
54615
|
+
element.removeEventListener(cornerstone.EVENTS.IMAGE_RENDERED, onImageRendered);
|
|
54616
|
+
removeDom(id);
|
|
54617
|
+
};
|
|
54618
|
+
|
|
54619
|
+
function removeDom(id) {
|
|
54620
|
+
var dom = document.getElementById(id);
|
|
54656
54621
|
|
|
54657
54622
|
if (dom) {
|
|
54658
54623
|
document.body.removeChild(dom);
|
|
@@ -54667,9 +54632,11 @@ function removeDom() {
|
|
|
54667
54632
|
}
|
|
54668
54633
|
|
|
54669
54634
|
reactHotLoader.register(domId, "domId", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54670
|
-
reactHotLoader.register(
|
|
54635
|
+
reactHotLoader.register(actionPool, "actionPool", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54636
|
+
reactHotLoader.register(currentActionIndex, "currentActionIndex", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54671
54637
|
reactHotLoader.register(getMultiImageDataFromWodo, "getMultiImageDataFromWodo", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54672
54638
|
reactHotLoader.register(getImage, "getImage", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54639
|
+
reactHotLoader.register(onImageRendered, "onImageRendered", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54673
54640
|
reactHotLoader.register(removeDom, "removeDom", "/Users/huyeqing/workspace/chainz/paladin/src/utils/getImageDataFromWodo.js");
|
|
54674
54641
|
})();
|
|
54675
54642
|
|
|
@@ -54687,7 +54654,6 @@ var __signature__$3l = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoa
|
|
|
54687
54654
|
return a;
|
|
54688
54655
|
};
|
|
54689
54656
|
var paladinUtils = {
|
|
54690
|
-
getImageDataFromWodo: getImageDataFromWodo,
|
|
54691
54657
|
getMultiImageDataFromWodo: getMultiImageDataFromWodo
|
|
54692
54658
|
};
|
|
54693
54659
|
var _default$1b = _default$1a;
|