【问题标题】:Can ports be changed from circle to rectangle?端口可以​​从圆形更改为矩形吗?
【发布时间】:2018-12-03 02:09:44
【问题描述】:

我正在使用 JointJS 端口。默认情况下,端口显示为圆圈:

https://resources.jointjs.com/tutorial/ports

有没有办法将样式从圆形格式化为矩形?请建议我可以覆盖它的任何类名。

【问题讨论】:

    标签: javascript port jointjs


    【解决方案1】:

    那里的教程使用devs.Model 形状,它有点过时了......

    端口配置中有一个markup 选项,更多信息请参见https://resources.jointjs.com/docs/jointjs/v2.1/joint.html#dia.Element.ports

    我推荐一个端口演示 (https://github.com/clientIO/joint/tree/master/demo/ports)。甚至还有您可能正在寻找的形状:

    var g6 = new joint.shapes.basic.Circle({
        position: { x: 50, y: 50 },
        size: { width: 500, height: 300 },
        attrs: {
            text: { text: 'compensateRotation: true', fill: '#6a6c8a' },
            circle: { stroke: '#31d0c6', 'stroke-width': 2 }
        },
        ports: {
            groups: {
                'a': {
                    position: {
                        name: 'ellipseSpread',
                        args: { startAngle: 0, dr: 0, compensateRotation: true }
                    },
                    label: {
                        position: 'radial'
                    },
                    attrs: {
                        rect: {
                            stroke: '#31d0c6',
                            'stroke-width': 2,
                            width: 20,
                            height: 20,
                            x: -10,
                            y: -10
                        },
                        '.dot': {
                            fill: '#fe854f',
                            r: 2
                        },
                        text: {
                            fill: '#6a6c8a'
                        }
                    },
                    markup: '<g><rect/><circle class="dot"/></g>'
                }
            }
        }
    });
    

    【讨论】:

    • 谢谢它的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-14
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 2021-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多