相关疑难解决方法(0)

如何在Raphael javascript库中组合对象?

抱歉,这是一个很长的问题.我想在这里修改demo的拖动形状:

http://raphaeljs.com/graffle.html

该演示工作正常.我想要做的是将单词放在形状中,并将形状和文本作为复合单个对象移动.

以下是创建对象的代码:

window.onload = function () {
    var dragger = function () {
        this.ox = this.type == "rect" ? this.attr("x") : this.attr("cx");
        this.oy = this.type == "rect" ? this.attr("y") : this.attr("cy");
        this.animate({"fill-opacity": .2}, 500);
    },
        move = function (dx, dy) {
            var att = this.type == "rect" ? {x: this.ox + dx, y: this.oy + dy} : {cx: this.ox + dx, cy: this.oy + dy};
            this.attr(att);
            for (var i = connections.length; i--;) {
                r.connection(connections[i]);
            }
            r.safari();
        },
        up …
Run Code Online (Sandbox Code Playgroud)

javascript raphael

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

标签 统计

javascript ×1

raphael ×1