fabricjs

How to hide the overflow of photos in canvas?

*爱你&永不变心* 提交于 2019-12-12 00:34:45
问题 I am trying making a photo frame pattern on canvas. In which I want to put two, three or maybe more photos under an overlay frame. Where few parts of the overlay frame are transparent. If I upload photo1 into first section of frame its visible into second section also and uploading photo2 into section two is also visible into first section. Depending on which photo is uploaded first or edited at last is overlapping the other photo. I want to know how to hide the overflow of photo so it should

Controls coordinates do not match group coordinates

依然范特西╮ 提交于 2019-12-12 00:04:03
问题 I do have a group with multiple objects. If the group is not rotated. Everything looks fine and controls are as expected. However, when I take exactly the same group and set the rotation angle programmatically before rendering, my controls coordinates equal the bounding rect, but not the group coordinates anymore. I have created a simplied version of the problem here: http://jsfiddle.net/schacki/avd6sjps/2/ fabric.Object.prototype.originX = "center"; fabric.Object.prototype.originY = "center"

How can I display the mouse coordinates in fabric.js

房东的猫 提交于 2019-12-11 23:35:28
问题 Hi I'm trying to display or capture the mouse coordinates in my program. In this program, you can click on any button and corresponding image will appear. I want to display the mouse coordinates on this too. I tried the following code but it doesn't work. Please let me know where I am going wrong. canvas.on('mouse:down', function(options){ getMouse(options);// its not an event its options of your canvas object }); function getMouse(options) { console.log(options);// you can check all options

Using fabricJS library in Win8 app?

浪子不回头ぞ 提交于 2019-12-11 17:33:47
问题 Has anyone successfully used FabricJS (or other similar libraries) in developing Windows 8 apps? I am trying, but keep getting fatal errors thrown at me (mainly, variables in the fabric file being undefined). I am trying to port a website I created using Fabric JS over, but I am wondering because the site does not work on IE.. so would it even work on Win8 native apps? 来源: https://stackoverflow.com/questions/13328022/using-fabricjs-library-in-win8-app

fabric canvas on top of another canvas

风格不统一 提交于 2019-12-11 17:32:32
问题 Is there a way to have two fabricJS canvases one top of each other? I want to be able to draw on both canvases, but I want my lines contained only on Canvas Top. Canvas Bottom will have labels that will not be able to be drawn on Canvas Top. Crude image of what I'm trying to go for I thought I could layer two canvases together, one on top of another using css: <style> .div { width: 1550px; height: 512px; border: solid 0px #4a7497; margin-top: -512px; margin-left: 100px; position: relative; }

How to do undo redo in fabric js using enlivenObjects

百般思念 提交于 2019-12-11 17:10:05
问题 The undo redo functionality works fine with this piece code but how to do the same with using fabricjs enlivenObjects method.I want the same results to implemented using enlivenObjects instead of using loadFromJSON method.the objects in the canvas objects container should be able to undo as well as redo. <input type="button" value="addrect" onclick="addrect()"> <input type="button" value="undo" onclick="undo()"> <input type="button" value="redo" onclick="redo()"> <input type="button" value=

FabricJS: How to auto-resize image to fit group or rectangle object?

。_饼干妹妹 提交于 2019-12-11 17:01:50
问题 Goal: I'm seeking to add an image to a FabricJS group or rectangle object, and for the image to maintain it's original aspect ratio and center fit it's parent width/height. I don't want the image overflow to show, but will show the overflow as a less opaque green in the examples below: Landscape Image Example : If it was a landscape oriented image, it would scale to max height, but then center itself with regards to width placement: Since I'm not looking for the image overflow to show, the

Generate PDF using svg raw data in php

為{幸葍}努か 提交于 2019-12-11 16:07:37
问题 Is it possible to generate pdf using svg raw data (getting from fabric js) on php side? I have searched a bit and found this example: https://tcpdf.org/examples/example_058/ but its except svg image not the svg raw data, so how one can generate pdf using svg raw data on server side using php? 回答1: Just pass your svg raw data to ImageSVG $svgRaw = '<svg height="80" width="300"> <g fill="none"> <path stroke="red" d="M5 20 l215 0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d

FabricJs: Saving and loading dynamic patterns from JSON (patternSourceCanvas)

℡╲_俬逩灬. 提交于 2019-12-11 15:54:43
问题 I am having a problem saving and loading dynamic patterns that are applied to objects. I have searched online for a solution to this to no avail. I understand why it is happening, but do not understand how to resolve it. Here is basically what I am doing... Applying dynamic pattern onto object. Saving the canvas to MongoDB using...'JSON.stringify(canvas.toJSON([...]))' Loading the canvas using 'loadFromJSON' Getting error 'Uncaught ReferenceError: patternSourceCanvas is not defined'

How to export fabricJS canvas in video format like mp4 with sound? [duplicate]

两盒软妹~` 提交于 2019-12-11 15:38:55
问题 This question already has answers here : How to save canvas animation as gif or webm? (2 answers) Closed 11 months ago . I'm trying to create an app using fabricJS which would allow the user to add a video on the canvas and some texts on it. I have achieved this till adding video & texts on the canvas. but I can't get any idea to export the canvas to mp4 format. The expected output is like, video is playing in background and there is a text on the video at a speific position. is there any