Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用图片后,出现的问题 #41

Closed
First-blood opened this issue Oct 17, 2013 · 12 comments
Closed

使用图片后,出现的问题 #41

First-blood opened this issue Oct 17, 2013 · 12 comments

Comments

@First-blood
Copy link

我现在用一个png格式的图片来绘制,有个问题是 程序会给这个png添加一个颜色导致其显示不好看,如何才能阻止这个添加?
效果图:
正常情况下:
123
拖入一个新的图形后:
2333

@First-blood
Copy link
Author

而且这个颜色会不停的加深,最后你懂的。。。

@kener
Copy link
Contributor

kener commented Oct 17, 2013

没有这个逻辑,我猜不是加深,是透明叠加了,出现了多个shape,看看自己的代码逻辑?

@First-blood
Copy link
Author

哦,不停的在以前的shape位置继续增加?但是我每次加完后重置一次opacity 就没有这个效果哟

@kener
Copy link
Contributor

kener commented Oct 17, 2013

这是你自己写的shape吗?有save和restore不应该啊

@First-blood
Copy link
Author

不是。。这个是 image.。对了 你的Image图形之所以在FF下面显示不出来是因为这个原因
123
在后面的image.complete这个判断
//图片已经加载完成
if (window.ActiveXObject) {
if (image.readyState != 'complete') {
return;
}
}
else {
if (!image.complete) {
return;
}
}
和 ctx.drawImage(image, x, y, width, height);都会有问题,所以这里我直接用了new Image()了。
drawStep : function(left, top, num) {
dancer.stepClick.className = "stepclick hide";
var pos1 = left - this.content.pos.left - 45;
var pos2 = top - this.content.pos.top - 21;
var pos3 = pos1 + 84;
var pos4 = pos2 + 36;
var src;
if(1 == num) {
src = "images/nstep.png";
}
else {
src = "images/dstep.png";
}
var shap = {
shape : 'image',
id : zr.newShapeId(),
style : {
x : 0,
y : 0,
image : src,
width : 182,
height : 40,
color:"#A8A8A8",
text : '人力主管部门归档',
textPosition :'inside',
textFont:'bold 15px verdana',
textColor : '#FFF'
},
draggable : true,
position : [pos1, pos2],
onmouseover : function(params) {
var shape = params.target;
if(2 == dancer.opreateNum) {
dancer.stepConnectTip.style.left = shape.position[0] + dancer.content.pos.left - 9 + "px";
dancer.stepConnectTip.style.top = shape.position[1] + dancer.content.pos.top - 9 + "px";
dancer.stepConnectTip.className = "stepConnectTip";
}
},
ondragstart : function(params) {
var shape = params.target;
dancer.draging = true;
dancer.dragTag = shape;
},
onmouseover : function(params) {

            },  
            ondragend : function() {
                dancer.draging = false;
                dancer.dragTag = "";
            },  
        }

        zr.addShape(shap);
        zr.render();
        if(0 != dancer.shapList.length) {
            for(var i = 0, shaper;shaper = dancer.shapList[i++];) {
                zr.modShape(shaper.id, {
                    style : {
                        opacity: 1  
                    }   
                }); 
                zr.refresh();
            }
        }
        temp = {"type" : "rectangle", "x1":pos1, "x2":pos3, "y1":pos2,  "y2":pos4 ,"id":shap.id};
        dancer.shapList.push(temp);
    },

这个是我整个绘制图片图形的函数。

@First-blood
Copy link
Author

http://www.processon.com/
今天同事看到了这个 感觉也很不错

@kener
Copy link
Contributor

kener commented Oct 21, 2013

问题解决了吗?发个邮件看看代码或直接给个能访问到了例子看看?

@First-blood
Copy link
Author

还没有,总体来说目前还是遇到了不少的问题,我想加你QQ和你详细说说 如果方便的话。 我的QQ是775486560

@kener
Copy link
Contributor

kener commented Oct 21, 2013

欢迎加入 echarts hi群 1379172

@First-blood
Copy link
Author

额 发送了消息 没人加入哟。。

@kener
Copy link
Contributor

kener commented Oct 21, 2013

百度hi群,不是qq啊~ 1379172

@kener
Copy link
Contributor

kener commented Nov 28, 2013

fixed 1.0.6

@kener kener closed this as completed Nov 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants