fabric实现消息泡泡编辑功能
代码语言:html
所属分类:其他
代码描述:fabric实现消息泡泡编辑功能
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> html, body, .center { width: 100%; height: 100%; } body { margin: 0; background: #eee; } .center { display: flex; justify-content: center; align-items: center; } canvas { display: block; border: 1px solid white; } </style> </head> <body translate="no"> <div class="center"> <canvas id="c" width="320" height="240"></canvas> </div> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/fabric-3.6.6.js"></script> <script> var boxPadding = 16; var arrowWidth = 32; var strokeWidth = 2; var handleSize = 24; var msg = 'Hello world, this is a Fabric.js speech bubble.'; var canvas = new fabric.Canvas('c'); var textbox = new fabric.Textbox(msg, { left: 50, top: 50, width: 180, fontSize: 16 }); var setCoords = textbox.setCoords.bind(textbox); textbox.on({ moving: setCoords, scaling: setCoords, rotating: setCoords }); var rect = new fabric.Rect({ fill: 'white', stroke: 'black', strokeWidth: strokeWidth, rx: 8, ry: 8 }); var handle = new fabric.Rect({ fill: 'transparent', left: 10, top: 200, width: handleSize, height: handleSize, hasRotatingPoint: false, hasControls: false }); var pol.........完整代码请登录后点击上方下载按钮下载查看
网友评论0