пятница, 26 апреля 2013 г., 12:43:35 UTC+4 пользователь Casel Chen написал:
I met the same problem. Sorry for not good at css yet, could you explain it in detail? How does it response by mouse wheel event when do zoom action? Could you paste some code snippet? Thanks!
在 2013年4月25日星期四UTC+8下午8时25分58秒,Deimon写道:
In this example I used jQuery
.scale_plus
{
position:relative; float:left; background-image:url('/css/up.gif'); cursor:pointer; width:28px;height:28px; z-index:1000; margin:4px 0 0 4px;
}
.scale_minus
{
position:relative; float:left; background-image:url('/css/down.gif'); cursor:pointer; width:28px;height:28px; z-index:1000; margin:4px 0 0 4px;
}
<script>
var sc=1;
$(document).ready(function(){
if(navigator.appName.indexOf("Explorer")<0){
$("#infovis").html('<div class=\"scale_plus\" onclick=\"res(1.25)\"></div><div class=\"scale_minus\" onclick=\"res(.8)\"></div>');
}
})
onCreateLabel: function(label, node){
label.id =
node.id;
label.className="st_label"
$(label).css("-moz-transform", "scale(" + sc +"," + sc + ")")
$(label).css("-webkit-transform", "scale(" + sc +"," + sc + ")")
$(label).css("-ms-transform", "scale(" + sc +"," + sc + ")")
$(label).css("-o-transform", "scale(" + sc +"," + sc + ")")
....
function res(msht){
if(sc*msht>0.1 && sc*msht<1.25){
sc=sc*msht;
var canv=st.canvas;
canv.scale(msht,msht);
$(".st_label").each(function(){
$(this).css("-moz-transform", "scale(" + sc +"," + sc + ")")
$(this).css("-webkit-transform", "scale(" + sc +"," + sc + ")")
$(this).css("-ms-transform", "scale(" + sc +"," + sc + ")")
$(this).css("-o-transform", "scale(" + sc +"," + sc + ")")
})
}
}