小编Abd*_*auf的帖子

SVG与变换矩阵坐标

我想在矩形元素上实现像svg-edit这样的功能

  1. 旋转矩形
  2. 调整
  3. 拖动

旋转SVG矩形它工作正常,但是当我想调整矩形大小时它有问题.坐标不正常; 我使用变换矩阵进行旋转,targetelement.setAttribute(transform,rotate(45,cx,cy)) 但是当旋转 元素时,会移动坐标.我也使用inverse函数来反转变换矩阵它解决了问题,但它不适用于拖动函数.

html5 svg

28
推荐指数
1
解决办法
2万
查看次数

raphaeljs拖放

我在我的网络应用程序中使用rapaeljs.我想设置对象的可丢弃边界.对象可以在可丢弃区域中移动.一旦物体进入可伸缩区域,对象就应该没有出路.

javascript raphael

20
推荐指数
1
解决办法
2万
查看次数

带有节点js示例的套接字

大家好我有问题....

客户端代码

 <html>
    <body onload="fun()">
    <script src="C:\cygwin\usr\local\lib\node\.npm\socket.io\0.6.16\package\support\socket.io-client\socket.io.js"></script> 
    <script> 

    function fun()
    {
     alert("hello")   
     var socket = new io.Socket('localhost',{'port':8090});

    socket.on('connect', function(){ 
      socket.send('hi!'); 
    }) 

     socket.on('connect', function(){ console.log('connected to server');socket.send('hi there, this is a test message'); })


    socket.on('message', function(data){ 
      alert(data);
    })
    socket.on('disconnect', function(){}) 
    }
    </script> 
    </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

服务器端代码:

var http = require('http'),  
    io = require('socket.io'), // for npm, otherwise use require('./path/to/socket.io') 

server = http.createServer(function(req, res){ 
 // your normal server code 
 res.writeHead(200, {'Content-Type': 'text/html'}); 
 res.end('<h1>Hello world</h1>'); 
});
server.listen(8090);

// socket.io 
var socket = io.listen(server); 
socket.on('connection', …
Run Code Online (Sandbox Code Playgroud)

node.js socket.io

4
推荐指数
1
解决办法
1万
查看次数

在Firefox和Chrome中上传图片

<html>

<body>

   <form name="Upload" enctype="multipart/form-data" method="post">

         Filename: <INPUT type="file" id="submit">

         <INPUT type="button" id="send" value="Upload">

    </form>

    <div id="div" align="center" style="height: 200px;width: 500px;border-style: ridge;border-color: red"></div>

</body>

<script type="text/javascript">



var img_id=0

var image = new Array()

document.getElementById('send').onclick=function()

{

    img_id++

    var id="imgid"+img_id

    image = document.getElementById('submit').value;

    document.getElementById('div').innerHTML="<img id='"+id+"' src='"+image+"' width=500px height=200px>"



}



</script>



</html>
Run Code Online (Sandbox Code Playgroud)

这段代码的问题是它只能在IE中工作而不能在其他浏览器中工作(firefox,chrome,等等).

编辑:(更新我的帖子以回应Naren,Bitslitter的)伙计们,这里的文字将添加到下面发布的讨论中:

谢谢大家的反馈,Naren和Bitslitter的反馈绝对具有启发性.

您能否请您推荐如何实现我想要做的事情:

在我的Web应用程序中,有一个按钮,在单击按钮时,出现浏览器打开对话框,询问图像文件,用户选择图像,图像在Web应用程序中打开.对我来说,让浏览器从本地服务器打开图像非常重要,因为我想使用HTML5 canvas标签来读取像素,然后动态地将这些像素转换为SVG(使用JS).这一切听起来都应该比它应该更复杂.

像Mugtug的Darkroom(http://mugtug.com/darkroom/)这样的Web应用程序已经能够实现我想要的目标.

javascript html5

3
推荐指数
1
解决办法
686
查看次数

标签 统计

html5 ×2

javascript ×2

node.js ×1

raphael ×1

socket.io ×1

svg ×1