|
@@ -75,6 +75,7 @@ function drawRect(stage, layer, item, tr, jointUrl) {
|
|
|
layer.draw();
|
|
|
};
|
|
|
//var imagesrc = images
|
|
|
+ imageObj.crossOrigin = 'Anonymous';
|
|
|
imageObj.src = joinUrl + item.style.fill.blipFill.url
|
|
|
//imageObj.width = item.fill.blipFill.tile.sx
|
|
|
//imageObj.height = item.fill.blipFill.tile.xy
|
|
@@ -259,6 +260,7 @@ function drawPath(stage, layer, item, tr, joinUrl) {
|
|
|
group.zIndex(item.index)
|
|
|
layer.draw();
|
|
|
};
|
|
|
+ imageObj.crossOrigin = 'Anonymous';
|
|
|
imageObj.src = joinUrl + item.style.fill.blipFill.url;
|
|
|
}
|
|
|
|
|
@@ -287,18 +289,12 @@ function drawImage(stage, layer, item, tr, imgUrl) {
|
|
|
};
|
|
|
var group = new Konva.Group(imageAttrs);
|
|
|
var imageUrl = item.image.url
|
|
|
+
|
|
|
var totalimages = imgUrl
|
|
|
var imagesURLinfo = imgUrl + item.image.url
|
|
|
var rotateNum = '0'
|
|
|
if (item.style.position.flipH === 1) { rotateNum = '180' } else if (item.style.position.flipV === 1) { rotateNum = '90' } else if (item.style.position.rot === 0.0) { rotateNum = item.style.position.rot }
|
|
|
console.log(imageUrl, '小地址')
|
|
|
- //console.log(totalimages[imageUrl].path,'大地址')
|
|
|
- //console.log(totaljson.stores[imageUrl])
|
|
|
- //for (let key in totalimages) {
|
|
|
- // if (imageUrl === key) {
|
|
|
- // imagesURLinfo = imgUrl + item.image.url
|
|
|
- // }
|
|
|
- //}
|
|
|
console.log(imagesURLinfo, '图片的地址1111')
|
|
|
Konva.Image.fromURL(imagesURLinfo, function (darthNode) {
|
|
|
darthNode.setAttrs({
|
|
@@ -313,6 +309,7 @@ function drawImage(stage, layer, item, tr, imgUrl) {
|
|
|
drawImage.destroy();
|
|
|
}
|
|
|
});
|
|
|
+ //darthNode.setAttribute('crossOrigin', 'anonymous');
|
|
|
group.add(darthNode)
|
|
|
layer.add(group);
|
|
|
group.zIndex(item.index+1)
|
|
@@ -627,9 +624,10 @@ function drawTable(stage, layer, group, item) {
|
|
|
var imageObj = new Image();
|
|
|
imageObj.src = img;
|
|
|
document.getElementById(tableid).remove()
|
|
|
+ imageObj.setAttribute('crossOrigin', 'anonymous');
|
|
|
imageObj.onload = function () {
|
|
|
var tableInfo = new Konva.Image({
|
|
|
- x: item.style.position.x,
|
|
|
+ x: item.style.position.x * scalingY,
|
|
|
y: item.style.position.y * scalingY,
|
|
|
image: imageObj,
|
|
|
width: imageObj.width,
|
|
@@ -660,14 +658,15 @@ function drawEchart(stage, layer, group, item) {
|
|
|
console.log('进入echarts的渲染方法')
|
|
|
console.log(item, '传送进来的内容')
|
|
|
var createdEchat = document.createElement('div')
|
|
|
- createdEchat.id = item.id
|
|
|
+ createdEchat.id = item.uid
|
|
|
createdEchat.style.width = item.style.position.cx + 'px'
|
|
|
createdEchat.style.height = item.style.position.cy + 'px'
|
|
|
createdEchat.style.position = 'relative'
|
|
|
- createdEchat.style.top = 9999 + 'px'
|
|
|
+ createdEchat.style.top = 999 + 'px'
|
|
|
var addEchatdiv = document.getElementById("container").appendChild(createdEchat);
|
|
|
- var Echatid = item.id
|
|
|
- console.log(Echatid, '元素ID')
|
|
|
+ var Echatid = item.uid
|
|
|
+ var htmldom = document.getElementById(Echatid)
|
|
|
+ console.log(htmldom, '获取html结构')
|
|
|
var titlename = []
|
|
|
var LineseriesData = []
|
|
|
var BarseriesData = []
|
|
@@ -924,22 +923,16 @@ function drawEchart(stage, layer, group, item) {
|
|
|
var imageObj = new Image();
|
|
|
imageObj.src = echartsinfo;
|
|
|
document.getElementById(Echatid).remove()
|
|
|
+ imageObj.setAttribute('crossOrigin', 'anonymous');
|
|
|
imageObj.onload = function () {
|
|
|
var EchartsInfo = new Konva.Image({
|
|
|
- x: item.style.position.x,
|
|
|
+ x: item.style.position.x * scalingY,
|
|
|
y: item.style.position.y * scalingY,
|
|
|
image: imageObj,
|
|
|
- width: imageObj.width,
|
|
|
- height: imageObj.height,
|
|
|
+ width: imageObj.width * scalingY,
|
|
|
+ height: imageObj.height * scalingY,
|
|
|
draggable: true,
|
|
|
});
|
|
|
- EchartsInfo.on('dblclick', (e) => {
|
|
|
- console.log('触发了dblclick!')
|
|
|
- console.log(this, 'this指针内容')
|
|
|
- //that.EditContent = paragraphall.paragraph[0].texts[0].content
|
|
|
- //that.NowOption = exercise.option
|
|
|
- //this.editorinfo = new Editors(this.$refs.editorElem)
|
|
|
- })
|
|
|
// add the shape to the layer
|
|
|
//group.add(tableInfo);
|
|
|
layer.add(EchartsInfo);
|
|
@@ -948,65 +941,13 @@ function drawEchart(stage, layer, group, item) {
|
|
|
//group.batchDraw();
|
|
|
};
|
|
|
});
|
|
|
- r(200)
|
|
|
+ r(htmldom)
|
|
|
})
|
|
|
}
|
|
|
-/*新的绘制多边形图形*/
|
|
|
-const drawPolygon = (stage, layer, item) => {
|
|
|
- console.log('调用到了方法')
|
|
|
- //var svgDiv = document.createElement('div')
|
|
|
- var createdDiv = document.createElement('div')
|
|
|
- document.getElementById('container').appendChild(createdDiv)
|
|
|
- createdDiv.id = item.id
|
|
|
- createdDiv.style.width = item.style.position.cx + 'px';
|
|
|
- createdDiv.style.height = item.style.position.cy + 'px';
|
|
|
- createdDiv.style.display = 'block'
|
|
|
- createdDiv.style.position = 'absolute'
|
|
|
- createdDiv.style.top = 9999 + 'px'
|
|
|
- var divId = item.id
|
|
|
- const svgDom = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
|
- svgDom.setAttribute('width', item.style.position.cx + 'px');
|
|
|
- svgDom.setAttribute('height', item.style.position.cy + 'px');
|
|
|
- //svgDom.setAttribute('style','position:absolute')
|
|
|
- svgDom.setAttribute('id', item.id + 'info')
|
|
|
- const polygonDom = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
|
|
- polygonDom.setAttribute('points', item.svg.points);
|
|
|
- polygonDom.setAttribute('style', 'fill:' + item.style.border.color.solidFill + ';strock:#ccc;stroke-width:1;');
|
|
|
- createdDiv.appendChild(svgDom)
|
|
|
- svgDom.appendChild(polygonDom)
|
|
|
- html2canvas(document.getElementById(divId), {
|
|
|
- backgroundColor: null,
|
|
|
- }).then((canvas) => {
|
|
|
- console.log(divId, '进来的ID')
|
|
|
- //document.getElementById(divId).innerHTML = "";
|
|
|
- var imageObj = new Image();
|
|
|
- var img = canvas.toDataURL();
|
|
|
- imageObj.src = img;
|
|
|
- console.log(img, '生成的图片')
|
|
|
- document.getElementById(divId).remove()
|
|
|
- imageObj.onload = function () {
|
|
|
- var svgimagInfo = new Konva.Image({
|
|
|
- x: item.style.position.x,
|
|
|
- y: item.style.position.y * scalingY,
|
|
|
- image: imageObj,
|
|
|
- width: imageObj.width,
|
|
|
- height: imageObj.height,
|
|
|
- draggable: true,
|
|
|
- });
|
|
|
- console.log(item.style.position.x, item.style.position.y, divId, '本次渲染的位置')
|
|
|
- // add the shape to the layer
|
|
|
- //group.add(tableInfo);
|
|
|
- layer.add(svgimagInfo);
|
|
|
- //group.zIndex(paragraphall.index+1)
|
|
|
- layer.batchDraw();
|
|
|
- };
|
|
|
- });
|
|
|
- if (item.paragraph && item.paragraph[0].texts.length) drawTextInfo(stage, layer, item, group, item.paragraph[0].style.position)
|
|
|
-}
|
|
|
/**
|
|
|
* 导出
|
|
|
**/
|
|
|
|
|
|
export {
|
|
|
- drawRect, drawArc, drawEllipse, drawPath, drawImage, drawLine, drawTextInfo, drawTable, drawEchart, drawPolygon
|
|
|
+ drawRect, drawArc, drawEllipse, drawPath, drawImage, drawLine, drawTextInfo, drawTable, drawEchart
|
|
|
}
|