mazong1123 / fabric.ext Goto Github PK
View Code? Open in Web Editor NEWAn extension of fabricjs. Intends to implement objects and events missed in fabricjs.
License: MIT License
An extension of fabricjs. Intends to implement objects and events missed in fabricjs.
License: MIT License
On canvas resize, make all objects resized to new aspect ration.
Plan to add video/audio object. Please let me know if you have any thought of this feature.
It's possible to make an object event on click whch object is inside group?
$("#activities_1").click(function(){
task_nr++;
global_ctx_nr++;
task[task_nr] = new fabric.Rect({
width: 120,
height: 60,
angle: 0,
rx: 10,
ry: 10,
fill: 'rgba(0,0,0,0.0)',
strokeWidth: 2,
stroke: 'rgb(0,0,0)',
originX: 'center',
originY: 'center'
});
task_text[task_nr] = new fabric.IText('Task ' + task_nr, {
fontSize: 10,
fontFamily: 'Arial',
originX: 'center',
originY: 'center'
});
task_group[task_nr] = new fabric.Group([ task[task_nr], task_text[task_nr] ], {
transparentCorners: false,
hasRotatingPoint: false,
lockScalingX: true,
lockScalingY: true,
left: 10,
top: 10,
hasBorders: false,
cornerColor: 'rgb(166,32,72)',
imsID: 'global_ctx_nr_' + global_ctx_nr,
imsOBJ_ID: '0'
});
task_group[task_nr].setControlsVisibility({tl: false, tr: false,bl: false, br: false,});
task_group[task_nr].on('object:dblclick', function (e) {
var o = canvas.getActiveObject();
var imsID = o.get('imsID');
var posX = 0;
var posY = 0;
posX = e.e.clientX - 50;
posY = e.e.clientY - 50;
var imsOBJ_ID = '0';
imsOBJ_ID = o.get('imsOBJ_ID');
if(imsOBJ_ID === '0' || imsOBJ_ID === 'undefined')
{
$('#contextMenueNichtVerlinkt').css('top', posY);
$('#contextMenueNichtVerlinkt').css('left', posX);
$('#contextMenueNichtVerlinkt').css('display', 'block');
}
else
{
$('#contextMenueVerlinkt').css('top', posY);
$('#contextMenueVerlinkt').css('left', posX);
$('#contextMenueVerlinkt').css('display', 'block');
o.set("fill",'rgba(166,32,72,0.1)');
canvas.renderAll();
}
});
canvas.add(task_group[task_nr]).setActiveObject(task_group[task_nr]);
});
But when i save the elements on Canvas with canvas.toJSON() and reload with canvas.loadFromJSON() the DbClick-Function do not work.
canvas.toJason:
_var imsCanvasInhalt = JSON.stringify(canvas.toJSON(['imsID', 'imsOBJ_ID', 'controlsVisibility', 'hasRotatingPoint', 'hasBorders', 'cornerColor', 'borderColor', 'transparentCorners', 'lockScalingX', 'lockScalingY']));
canvas.loadFromJason:
canvas.loadFromJSON(<%= diaDiagramm %>, canvas.renderAll.bind(canvas));
Is this a problem of your library or the canvas.toJSON-funktion/canvas.loadFromJSON-funktion?
Another problem is the:
canvas.fireEventForObjectInsideGroup = true;
this do not work.
I can not edit, move, rotate the task_text[task_nr] in the task_group[task_nr].
How to make double click working on mozzila ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.