{"id":254413,"date":"2015-04-02T23:54:03","date_gmt":"2015-04-02T19:54:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=254413"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=254413","title":{"rendered":"\u0417\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 Fabric.js. \u0427\u0430\u0441\u0442\u044c 3-\u044f"},"content":{"rendered":"<p> \t\t\t<i>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 Javascript canvas \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Fabric.js.<\/i><\/p>\n<p>  \u041c\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043e Fabric \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/162367\/\">\u043f\u0435\u0440\u0432\u043e\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167119\/\">\u0432\u0442\u043e\u0440\u043e\u0439 <\/a>\u0447\u0430\u0441\u0442\u044f\u0445 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0413\u0440\u0443\u043f\u043f\u044b<\/h2>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/8.png\" alt=\"image\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u043e \u0447\u0435\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u2013 \u044d\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u044b. \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2013 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043c\u043e\u0449\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 Fabric. \u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b? \u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u0430\u043a \u0441 \u0435\u0434\u0438\u043d\u044b\u043c \u0446\u0435\u043b\u044b\u043c.<\/p>\n<p>  \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u043a\u0430\u043a \u043c\u044b <a href=\"http:\/\/habrahabr.ru\/post\/162367\/\">\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438<\/a> \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u044b\u0448\u0438? \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0432 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0438 \u0434\u0430\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0430 \u2014 \u0446\u0432\u0435\u0442, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u0440\u0430\u043c\u043a\u0443 \u0438 \u0442.\u0434.<\/p>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u0440\u0443\u043f\u043f\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 canvas (\u043a\u0430\u043a \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0448\u0435), Fabric \u043d\u0435\u044f\u0432\u043d\u043e, \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0438\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e. \u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043c\u044b\u0441\u043b <code>fabric.Group<\/code>. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0438\u0437 2 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u0440\u0443\u0433\u0430 \u0438 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">var circle = new fabric.Circle({   radius: 100,   fill: '#eef',   scaleY: 0.5,   originX: 'center',   originY: 'center' });  var text = new fabric.Text('hello world', {   fontSize: 30,   originX: 'center',   originY: 'center' });  var group = new fabric.Group([ circle, text ], {   left: 150,   top: 100,   angle: -10 });  canvas.add(group); <\/code><\/pre>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u00abhello world\u00bb. \u0417\u0430\u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c <code>originX<\/code> \u0438 <code>originY<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code> 'center'<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b. \u041f\u0440\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0447\u043b\u0435\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u0430 \u0433\u0440\u0443\u043f\u043f\u044b. \u0417\u0430\u0442\u0435\u043c \u043a\u0440\u0443\u0433 \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c \u0432 100px \u0437\u0430\u043a\u0440\u0430\u0441\u0438\u043b\u0438 \u0446\u0432\u0435\u0442\u043e\u043c &quot;#eef&quot; \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0441\u0436\u0430\u043b\u0438 (\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u0436\u0430\u0442\u0438\u044f \u2014 0.5). \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 <code>fabric.Group<\/code> c \u0434\u0432\u0443\u043c\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 2 \u043d\u0430\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0437\u0430\u0434\u0430\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u044e 150\/100 \u0438 \u0443\u0433\u043e\u043b -10. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0435\u0451 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>canvas.add()<\/code> \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443. <\/p>\n<p>  \u0418, \u0432\u0443\u0430\u043b\u044f! \u0412\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430 canvas, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u044d\u043b\u043b\u0438\u043f\u0441 \u0441 \u043d\u0430\u0434\u043f\u0438\u0441\u044c\u044e. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0433\u0440\u0443\u043f\u043f\u044b. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043a\u0430\u043a \u0441 \u0435\u0434\u0438\u043d\u044b\u043c \u0446\u0435\u043b\u044b\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_1.png\" alt=\"image\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0430 \u043d\u0430 canvas. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0435 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c.<\/p>\n<pre><code class=\"javascript\">group.item(0).setFill('red'); group.item(1).set({   text: 'trololo',   fill: 'white' });  canvas.renderAll(); <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442? \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>item()<\/code> \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u2013 \u044d\u0442\u043e \u0441\u0436\u0430\u0442\u044b\u0439 \u043a\u0440\u0443\u0433, \u0432\u0442\u043e\u0440\u043e\u0439 \u2013 \u0442\u0435\u043a\u0441\u0442. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_2.png\" alt=\"image\"\/><\/p>\n<p>  \u0412\u0430\u0436\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u2014 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u044b \u0432\u044b\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u0433\u0440\u0443\u043f\u043f\u044b. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u0442\u0435\u043a\u0441\u0442-\u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043e\u043d \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0448\u0438\u0440\u0438\u043d\u044b. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c, \u0437\u0430\u0434\u0430\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (\u043b\u0435\u0432\u043e\\\u0432\u0435\u0440\u0445).<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438 \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c 3 \u043a\u0440\u0443\u0433\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438\u0441\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<pre><code class=\"javascript\">var circle1 = new fabric.Circle({   radius: 50,   fill: 'red',   left: 0 }); var circle2 = new fabric.Circle({   radius: 50,   fill: 'green',   left: 100 }); var circle3 = new fabric.Circle({   radius: 50,   fill: 'blue',   left: 200 });  var group = new fabric.Group([ circle1, circle2, circle3 ], {   left: 200,   top: 100 });  canvas.add(group); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_3.png\" alt=\"image\"\/><\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <b>\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/b>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044f \u0433\u0440\u0443\u043f\u043f\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0438\u0441\u044c. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0443 Fabric \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">fabric.Image.fromURL('\/assets\/pug.jpg', function(img) {   var img1 = img.scale(0.1).set({ left: 100, top: 100 });    fabric.Image.fromURL('\/assets\/pug.jpg', function(img) {     var img2 = img.scale(0.1).set({ left: 175, top: 175 });      fabric.Image.fromURL('\/assets\/pug.jpg', function(img) {       var img3 = img.scale(0.1).set({ left: 250, top: 250 });        canvas.add(new fabric.Group([ img1, img2, img3], { left: 200, top: 200 }))     });   }); }); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_4.png\" alt=\"image\"\/><\/p>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0443 \u0433\u0440\u0443\u043f\u043f. \u041c\u0435\u0442\u043e\u0434 <code>getObjects()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a <code>fabric.Canvas#getObjects()<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b. \u0415\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>size()<\/code>, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0447\u0438\u0441\u043b\u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>contains()<\/code>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435. \u0423\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u043c\u0435\u0442\u043e\u0434 <code>item()<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0431\u0440\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b. \u041c\u0435\u0442\u043e\u0434 <code>forEachObject()<\/code>, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a <code>fabric.Canvas#forEachObject<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438. \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u0435\u0442\u043e\u0434\u044b <code>add()<\/code> \u0438 <code>remove()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0438 \u0443\u0434\u0430\u043b\u044f\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b. <\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\/\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0421 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438\/\u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u0431\u0435\u0437. <br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 \u0446\u0435\u043d\u0442\u0440 \u0433\u0440\u0443\u043f\u043f\u044b.<\/p>\n<pre><code class=\"javascript\">group.add(new fabric.Rect({   ...   originX: 'center',   originY: 'center' })); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 100px \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<pre><code class=\"javascript\">group.add(new fabric.Rect({   ...   left: 100,   top: 100,   originX: 'center',   originY: 'center' })); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 \u0446\u0435\u043d\u0442\u0440 \u0433\u0440\u0443\u043f\u043f\u044b <b>\u0438<\/b> \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<pre><code class=\"javascript\">group.addWithUpdate(new fabric.Rect({   ...   left: group.getLeft(),   top: group.getTop(),   originX: 'center',   originY: 'center' })); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 100px \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0433\u0440\u0443\u043f\u043f\u044b <b>\u0438<\/b> \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<pre><code class=\"javascript\">group.addWithUpdate(new fabric.Rect({   ...   left: group.getLeft() + 100,   top: group.getTop() + 100,   originX: 'center',   originY: 'center' })); <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 canvas, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">\/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0441 \u043a\u043e\u043f\u0438\u044f\u043c\u0438 2-\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. var group = new fabric.Group([   canvas.item(0).clone(),   canvas.item(1).clone() ]);  \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c. canvas.clear().renderAll();  \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u043d\u0430 canvas. canvas.add(group); <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0447\u043d\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 canvas, \u0438\u043b\u0438 \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f <b>\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f canvas<\/b>. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 canvas? \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c canvas \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u044d\u0442\u043e \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442, \u0447\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0437, \u0442\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441 Fabric.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b toObject, toJSON<\/h4>\n<p>  \u041e\u0441\u043d\u043e\u0432\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Fabri\u0441 \u2014 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>fabric.Canvas#toObject()<\/code> \u0438 <code>fabric.Canvas#toJSON()<\/code>.<br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e canvas.<\/p>\n<pre><code class=\"javascript\">var canvas = new fabric.Canvas('c'); JSON.stringify(canvas); \/\/ '{&quot;objects&quot;:[],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}' <\/code><\/pre>\n<p>  \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ES5 \u043c\u0435\u0442\u043e\u0434 <code>JSON.stringify()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>toJSON<\/code> \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041e\u0431\u044a\u0435\u043a\u0442 canvas \u0432 Fabric \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434, \u043e\u043d \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u0432\u044b\u0437\u043e\u0432\u0443 <code>JSON.stringify(canvas.toJSON())<\/code>.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0439 canvas. \u041e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 JSON, \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 &#187;objects&#187; \u0438 &#187;background&#187;. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e &#187;objects&#187; \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0441\u0442\u043e\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 canvas \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442, \u0430 &#187;background&#187; \u0438\u043c\u0435\u0435\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u00abrgba(0, 0, 0, 0)\u00bb).<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0434\u0438\u043c canvas \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u043d, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f.<\/p>\n<pre><code class=\"javascript\">canvas.backgroundColor = 'red'; JSON.stringify(canvas); \/\/ '{&quot;objects&quot;:[],&quot;background&quot;:&quot;red&quot;}' <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 canvas \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"javascript\">canvas.add(new fabric.Rect({   left: 50,   top: 50,   height: 20,   width: 20,   fill: 'green' })); console.log(JSON.stringify(canvas)); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:  <\/p>\n<pre><code class=\"javascript\">'{&quot;objects&quot;:[{&quot;type&quot;:&quot;rect&quot;,&quot;left&quot;:50,&quot;top&quot;:50,&quot;width&quot;:20,&quot;height&quot;:20,&quot;fill&quot;:&quot;green&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;rx&quot;:0,&quot;ry&quot;:0}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}' <\/code><\/pre>\n<p>  \u0423\u0445 \u0442\u044b! \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0432\u0448\u0438\u0441\u044c, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#187;objects&#187;, \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 JSON. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b: \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0448\u0438\u0440\u0438\u043d\u0430, \u0432\u044b\u0441\u043e\u0442\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043a\u0430\u0436\u0435\u043c \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043a\u0440\u0443\u0433, \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0437\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. <\/p>\n<pre><code class=\"javascript\">canvas.add(new fabric.Circle({   left: 100,   top: 100,   radius: 50,   fill: 'red' })); console.log(JSON.stringify(canvas)); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:  <\/p>\n<pre><code class=\"javascript\">'{&quot;objects&quot;:[{(\u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a) &quot;type&quot;:&quot;rect&quot;,&quot;left&quot;:50,&quot;top&quot;:50,&quot;width&quot;:20,&quot;height&quot;:20,&quot;fill&quot;:&quot;green&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;rx&quot;:0,&quot;ry&quot;:0},{(\u041a\u0440\u0443\u0433) &quot;type&quot;:&quot;circle&quot;,&quot;left&quot;:100,&quot;top&quot;:100,&quot;width&quot;:100,&quot;height&quot;:100,&quot;fill&quot;:&quot;red&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;radius&quot;:50}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}' <\/code><\/pre>\n<p>  \u042f \u0432\u044b\u0434\u0435\u043b\u0438\u043b <code>&quot;type&quot;:&quot;rect&quot;<\/code> \u0438 <code>&quot;type&quot;:&quot;circle&quot;<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0433\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u0430\u044f, \u043d\u043e \u044d\u0442\u043e \u0435\u0449\u0435 \u0446\u0432\u0435\u0442\u043e\u0447\u043a\u0438, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 1\/10(!) \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u043c\u0435\u0442\u043e\u0434 <code>canvas.toDataURL('png')<\/code>:<\/p>\n<pre><code class=\"javascript\">'data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAK8CAYAAAAXo9vkAAAgAElEQVR4Xu3dP4xtBbnG4WPAQOQ2YBCLK1qpoQE1\/m+NVlCDwUACicRCEuysrOwkwcJgAglEItRQaWz9HxEaolSKtxCJ0FwMRIj32zqFcjm8e868s2fNWo\/Jygl+e397rWetk5xf5pyZd13wPwIECBAgQIAAAQIECBxI4F0H+hwfQ4AAAQIECBAgQIAAgQsCxENAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECAsQzQIAAAQIECBAgQIDAwQQEyMGofRABAgQIECBAgAABAgLEM0CAAAECBAgQIECAwMEEBMjBqH0QAQIECBAgQIAAAQICxDNAgAABAgQIECBAgMDBBATIwah9EAECBAgQIECAAAECyw+Qb134R\/U2fevC8q+5esGWESBAgAABAgQIEFiOwPL\/MC5AlvO0OBMCBAgQIECAAAECJxQQICcE9HYCBAgQIECAAAECBPYXECD7W3klAQIECBAgQIAAAQInFBAgJwT0dgIECBAgQIAAAQIE9hcQIPtbeSUBAgQIECBAgAABAicUECAnBPR2AgQIECBAgAABAgT2FxAg+1t5JQECBAgQIECAAAECJxQQICcE9HYCBAgQIECAAAECBPYXECD7W3klAQIECBAgQIAAAQInFBAgJwTc9+3z49yvmNd+dI7PzPHJOW6Y4wNzXD3HlXNc9pZdb85\/vzbHK3P8aY7n5vj1HL+Y43dz417f97O9jgABAgQIECBAgMBSBATIKd2JCY5dWNwyx5fn+PwcV5U\/6tXZ99M5fjjHk3Mjd6HifwQIECBAgAABAgQWLSBAirdnouP6WXfvHHfOcU1x9T6rXp4XPTLHA3NTX9jnDV5DgAABAgQIECBA4NACAuSE4hMdl8+Kr83xzTmuO+G61ttfnEXfnuN7c4PfaC21hwABAgQIECBAgMBJBQTIJQpOeFw7b71\/jtsvccWh3vbYfNB9c6NfOtQH+hwCBAgQIECAAAECFxMQIMd8No7C4+F5283HfOtZv\/ypOYG7hMhZ3wafT4AAAQIECBDYtoAA2fP+H\/1Vqwd3f4jf8y1Lfdkunu7xV7OWenucFwECBAgQIEBg3QICZI\/7O\/Fxx7xs9wf3t36r3D3evciX7L7F7+6rIY8u8uycFAECBAgQIE' <\/code><\/pre>\n<p>  \u0418 \u0435\u0449\u0435 <a href=\"https:\/\/gist.github.com\/kangax\/d11b576ad741614ed73e\">~17000 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/a>.<\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 <code>fabric.Canvas#toObject<\/code>. \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e: <code>toObject<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0438 <code>toJSON<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0437\u044c\u043c\u0435\u043c canvas \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u0432 \u0432\u0438\u0434\u0435 \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. <code>canvas.toObject()<\/code> \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:<\/p>\n<pre><code class=\"javascript\">{ &quot;background&quot; : &quot;rgba(0, 0, 0, 0)&quot;,   &quot;objects&quot; : [     {       &quot;angle&quot; : 0,       &quot;fill&quot; : &quot;green&quot;,       &quot;flipX&quot; : false,       &quot;flipY&quot; : false,       &quot;hasBorders&quot; : true,       &quot;hasControls&quot; : true,       &quot;hasRotatingPoint&quot; : false,       &quot;height&quot; : 20,       &quot;left&quot; : 50,       &quot;opacity&quot; : 1,       &quot;overlayFill&quot; : null,       &quot;perPixelTargetFind&quot; : false,       &quot;scaleX&quot; : 1,       &quot;scaleY&quot; : 1,       &quot;selectable&quot; : true,       &quot;stroke&quot; : null,       &quot;strokeDashArray&quot; : null,       &quot;strokeWidth&quot; : 1,       &quot;top&quot; : 50,       &quot;transparentCorners&quot; : true,       &quot;type&quot; : &quot;rect&quot;,       &quot;width&quot; : 20     }   ] } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0432\u044b\u0432\u043e\u0434 <code>toJSON<\/code> \u044d\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 <code>toObject<\/code>. \u041c\u0435\u0442\u043e\u0434 <code>toObject<\/code> \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0438 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u043d \u00ab\u0443\u043c\u043d\u044b\u0439\u00bb \u0438 \u00ab\u043b\u0435\u043d\u0438\u0432\u044b\u0439\u00bb. \u0422\u043e, \u0447\u0442\u043e \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u2013 \u044d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c canvas, \u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <code>toObject<\/code>. \u041e\u0431\u044a\u0435\u043a\u0442 \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u00bb <code>fabric.Path<\/code> \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 <code>toObject<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 &#187;points&#187;. \u0418 <code>fabric.Image<\/code> \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e &#187;src&#187; \u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0421\u043b\u0435\u0434\u0443\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0443 \u041e\u041e\u041f, \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u0435\u0431\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb, \u0438\u043b\u0438 \u0436\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <code>toObject<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. <br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"javascript\">var rect = new fabric.Rect(); rect.toObject = function() {   return { name: 'trololo' }; }; canvas.add(rect); console.log(JSON.stringify(canvas)); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:<\/p>\n<pre><code class=\"javascript\">'{&quot;objects&quot;:[{&quot;name&quot;:&quot;trololo&quot;}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}' <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u0430\u0441\u0441\u0438\u0432 &#187;objects&#187; \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 <b>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/b> \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 <code>toObject<\/code> \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<pre><code class=\"javascript\">var rect = new fabric.Rect();  rect.toObject = (function(toObject) {   return function() {     return fabric.util.object.extend(toObject.call(this), {       name: this.name     });   }; })(rect.toObject);  canvas.add(rect);  rect.name = 'trololo';  console.log(JSON.stringify(canvas)); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:<\/p>\n<pre><code class=\"javascript\">'{&quot;objects&quot;:[{&quot;type&quot;:&quot;rect&quot;,&quot;left&quot;:0,&quot;top&quot;:0,&quot;width&quot;:0,&quot;height&quot;:0,&quot;fill&quot;:&quot;rgb(0,0,0)&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;rx&quot;:0,&quot;ry&quot;:0,&quot;name&quot;:&quot;trololo&quot;}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}' <\/code><\/pre>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <code>toObject<\/code> \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c &#187;name&#187;. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430. \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>fabric.Rect<\/code>) \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u043d\u043e\u0432\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 &#187;stateProperties&#187;. \u0422\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434 toSVG<\/h4>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 canvas \u2014 \u044d\u0442\u043e SVG \u0444\u043e\u0440\u043c\u0430\u0442. Fabric \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 SVG \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 canvas. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 canvas \u0432 SVG \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043d\u0430 canvas \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043c\u0435\u0442\u043e\u0434 <code>toSVG<\/code>:<\/p>\n<pre><code class=\"javascript\">canvas.add(new fabric.Rect({   left: 50,   top: 50,   height: 20,   width: 20,   fill: 'green' })); console.log(canvas.toSVG()); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:<\/p>\n<pre><code class=\"javascript\">'&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot; ?&gt;&lt;!DOCTYPE svg PUBLIC &quot;-\/\/W3C\/\/DTD SVG 20010904\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/2001\/REC-SVG-20010904\/DTD\/svg10.dtd&quot;&gt;&lt;svg xmlns=&quot;http:\/\/www.w3.org\/2000\/svg&quot; xmlns:xlink=&quot;http:\/\/www.w3.org\/1999\/xlink&quot; version=&quot;1.1&quot; width=&quot;800&quot; height=&quot;700&quot; xml:space=&quot;preserve&quot;&gt;&lt;desc&gt;Created with Fabric.js 0.9.21&lt;\/desc&gt;&lt;rect x=&quot;-10&quot; y=&quot;-10&quot; rx=&quot;0&quot; ry=&quot;0&quot; width=&quot;20&quot; height=&quot;20&quot; style=&quot;stroke: none; stroke-width: 1; stroke-dasharray: ; fill: green; opacity: 1;&quot; transform=&quot;translate(50 50)&quot; \/&gt;&lt;\/svg&gt;' <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043a\u0430\u043a <code>toJSON<\/code> \u0438\u043b\u0438 <code>toObject<\/code>, <code>toSVG<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 canvas, \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 <code>toSVG<\/code> \u043c\u0435\u0442\u043e\u0434, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c <code>toSVG<\/code> \u043c\u0435\u0442\u043e\u0434, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>toObject<\/code>.<\/p>\n<p>  \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e SVG \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 <code>toObject\/toJSON<\/code> \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043b\u044e\u0431\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c \u043a SVG-\u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u0431\u0440\u0430\u0443\u0437\u0435\u0440, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u043d\u0442\u0435\u0440, \u043a\u0430\u043c\u0435\u0440\u0430 \u0438 \u0442.\u0434.). \u0421 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 toObject\/toJSON \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 canvas. \u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 canvas. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 canvas \u0432 \u0442\u0435\u043a\u0441\u0442, \u0430 \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c?<\/p>\n<h2>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, SVG \u043f\u0430\u0440\u0441\u0435\u0440<\/h2>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0441\u0442\u044c 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c canvas \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438: \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f JSON \u0438 SVG. \u0414\u043b\u044f JSON \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b <code>fabric.Canvas#loadFromJSON<\/code> \u0438 <code>fabric.Canvas#loadFromDatalessJSON<\/code>. \u0414\u043b\u044f SVG \u2014 \u043c\u0435\u0442\u043e\u0434\u044b <code>fabric.loadSVGFromURL<\/code> \u0438 <code>fabric.loadSVGFromString<\/code>.<br \/>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 canvas, \u0430 \u0434\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430 fabric.<\/p>\n<p>  \u041e\u0441\u043e\u0431\u043e \u043d\u0435\u0447\u0435\u0433\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445. \u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0442 \u043d\u0438\u0445 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 JSON \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 canvas:<\/p>\n<pre><code class=\"javascript\">var canvas = new fabric.Canvas();  canvas.loadFromJSON('{&quot;objects&quot;:[{&quot;type&quot;:&quot;rect&quot;,&quot;left&quot;:50,&quot;top&quot;:50,&quot;width&quot;:20,&quot;height&quot;:20,&quot;fill&quot;:&quot;green&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;rx&quot;:0,&quot;ry&quot;:0},{&quot;type&quot;:&quot;circle&quot;,&quot;left&quot;:100,&quot;top&quot;:100,&quot;width&quot;:100,&quot;height&quot;:100,&quot;fill&quot;:&quot;red&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:0,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;radius&quot;:50}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;}'); <\/code><\/pre>\n<p>  \u2026 \u041e\u0431\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 canvas:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_5.png\" alt=\"image\"\/><\/p>\n<p>  \u041d\u0443 \u0447\u0442\u043e \u0436\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c canvas \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0430 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 <code>loadFromDatalessJSON<\/code>? \u0412 \u0447\u0435\u043c \u0435\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043e\u0442 <code>loadFromJSON<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438? \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0430\u043c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 path \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u044d\u0442\u043e\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_6.png\" alt=\"image\"\/><\/p>\n<p>  \u2026 \u0438 <code>JSON.stringify(canvas)<\/code> \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"javascript\">'{&quot;objects&quot;:[{&quot;type&quot;:&quot;path&quot;,&quot;left&quot;:184,&quot;top&quot;:177,&quot;width&quot;:175,&quot;height&quot;:151,&quot;fill&quot;:&quot;#231F20&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:-19,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;path&quot;:[[&quot;M&quot;,39.502,61.823],[&quot;c&quot;,-1.235,-0.902,-3.038,-3.605,-3.038,-3.605],[&quot;s&quot;,0.702,0.4,3.907,1.203],[&quot;c&quot;,3.205,0.8,7.444,-0.668,10.114,-1.97],[&quot;c&quot;,2.671,-1.302,7.11,-1.436,9.448,-1.336],[&quot;c&quot;,2.336,0.101,4.707,0.602,4.373,2.036],[&quot;c&quot;,-0.334,1.437,-5.742,3.94,-5.742,3.94],[&quot;s&quot;,0.4,0.334,1.236,0.334],[&quot;c&quot;,0.833,0,6.075,-1.403,6.542,-4.173],[&quot;s&quot;,-1.802,-8.377,-3.272,-9.013],[&quot;c&quot;,-1.468,-0.633,-4.172,0,-4.172,0],[&quot;c&quot;,4.039,1.438,4.941,6.176,4.941,6.176],[&quot;c&quot;,-2.604,-1.504,-9.279,-1.234,-12.619,0.501],[&quot;c&quot;,-3.337,1.736,-8.379,2.67,-10.083,2.503],[&quot;c&quot;,-1.701,-0.167,-3.571,-1.036,-3.571,-1.036],[&quot;c&quot;,1.837,0.034,3.239,-2.669,3.239,-2.669],[&quot;s&quot;,-2.068,2.269,-5.542,0.434],[&quot;c&quot;,-3.47,-1.837,-1.704,-8.18,-1.704,-8.18],[&quot;s&quot;,-2.937,5.909,-1,9.816],[&quot;C&quot;,34.496,60.688,39.502,61.823,39.502,61.823],[&quot;z&quot;],[&quot;M&quot;,77.002,40.772],[&quot;c&quot;,0,0,-1.78,-5.03,-2.804,-8.546],[&quot;l&quot;,-1.557,8.411],[&quot;l&quot;,1.646,1.602],[&quot;c&quot;,0,0,0,-0.622,-0.668,-1.691],[&quot;C&quot;,72.952,39.48,76.513,40.371,77.002,40.772],[&quot;z&quot;],[&quot;M&quot;,102.989,86.943],[&quot;M&quot;,102.396,86.424],[&quot;c&quot;,0.25,0.22,0.447,0.391,0.594,0.519],[&quot;C&quot;,102.796,86.774,102.571,86.578,102.396,86.424],[&quot;z&quot;],[&quot;M&quot;,169.407,119.374],[&quot;c&quot;,-0.09,-5.429,-3.917,-3.914,-3.917,-2.402],[&quot;c&quot;,0,0,-11.396,1.603,-13.086,-6.677],[&quot;c&quot;,0,0,3.56,-5.43,1.69,-12.461],[&quot;c&quot;,-0.575,-2.163,-1.691,-5.337,-3.637,-8.605],[&quot;c&quot;,11.104,2.121,21.701,-5.08,19.038,-15.519],[&quot;c&quot;,-3.34,-13.087,-19.63,-9.481,-24.437,-9.349],[&quot;c&quot;,-4.809,0.135,-13.486,-2.002,-8.011,-11.618],[&quot;c&quot;,5.473,-9.613,18.024,-5.874,18.024,-5.874],[&quot;c&quot;,-2.136,0.668,-4.674,4.807,-4.674,4.807],[&quot;c&quot;,9.748,-6.811,22.301,4.541,22.301,4.541],[&quot;c&quot;,-3.097,-13.678,-23.153,-14.636,-30.041,-12.635],[&quot;c&quot;,-4.286,-0.377,-5.241,-3.391,-3.073,-6.637],[&quot;c&quot;,2.314,-3.473,10.503,-13.976,10.503,-13.976],[&quot;s&quot;,-2.048,2.046,-6.231,4.005],[&quot;c&quot;,-4.184,1.96,-6.321,-2.227,-4.362,-6.854],[&quot;c&quot;,1.96,-4.627,8.191,-16.559,8.191,-16.559],[&quot;c&quot;,-1.96,3.207,-24.571,31.247,-21.723,26.707],[&quot;c&quot;,2.85,-4.541,5.253,-11.93,5.253,-11.93],[&quot;c&quot;,-2.849,6.943,-22.434,25.283,-30.713,34.274],[&quot;s&quot;,-5.786,19.583,-4.005,21.987],[&quot;c&quot;,0.43,0.58,0.601,0.972,0.62,1.232],[&quot;c&quot;,-4.868,-3.052,-3.884,-13.936,-0.264,-19.66],[&quot;c&quot;,3.829,-6.053,18.427,-20.207,18.427,-20.207],[&quot;v&quot;,-1.336],[&quot;c&quot;,0,0,0.444,-1.513,-0.089,-0.444],[&quot;c&quot;,-0.535,1.068,-3.65,1.245,-3.384,-0.889],[&quot;c&quot;,0.268,-2.137,-0.356,-8.549,-0.356,-8.549],[&quot;s&quot;,-1.157,5.789,-2.758,5.61],[&quot;c&quot;,-1.603,-0.179,-2.493,-2.672,-2.405,-5.432],[&quot;c&quot;,0.089,-2.758,-1.157,-9.702,-1.157,-9.702],[&quot;c&quot;,-0.8,11.75,-8.277,8.011,-8.277,3.74],[&quot;c&quot;,0,-4.274,-4.541,-12.82,-4.541,-12.82],[&quot;s&quot;,2.403,14.421,-1.336,14.421],[&quot;c&quot;,-3.737,0,-6.944,-5.074,-9.879,-9.882],[&quot;C&quot;,78.161,5.874,68.279,0,68.279,0],[&quot;c&quot;,13.428,16.088,17.656,32.111,18.397,44.512],[&quot;c&quot;,-1.793,0.422,-2.908,2.224,-2.908,2.224],[&quot;c&quot;,0.356,-2.847,-0.624,-7.745,-1.245,-9.882],[&quot;c&quot;,-0.624,-2.137,-1.159,-9.168,-1.159,-9.168],[&quot;c&quot;,0,2.67,-0.979,5.253,-2.048,9.079],[&quot;c&quot;,-1.068,3.828,-0.801,6.054,-0.801,6.054],[&quot;c&quot;,-1.068,-2.227,-4.271,-2.137,-4.271,-2.137],[&quot;c&quot;,1.336,1.783,0.177,2.493,0.177,2.493],[&quot;s&quot;,0,0,-1.424,-1.601],[&quot;c&quot;,-1.424,-1.603,-3.473,-0.981,-3.384,0.265],[&quot;c&quot;,0.089,1.247,0,1.959,-2.849,1.959],[&quot;c&quot;,-2.846,0,-5.874,-3.47,-9.078,-3.116],[&quot;c&quot;,-3.206,0.356,-5.521,2.137,-5.698,6.678],[&quot;c&quot;,-0.179,4.541,1.869,5.251,1.869,5.251],[&quot;c&quot;,-0.801,-0.443,-0.891,-1.067,-0.891,-3.473]'... <\/code><\/pre>\n<p>  \u2026 \u0438 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 5-\u044f (!) \u0447\u0430\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<p>  \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442? Path \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043e\u0442\u0435\u043d \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043a\u0440\u0438\u0432\u044b\u0445 \u0411\u0435\u0437\u044c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0447\u0430\u0441\u0442\u0438 <code>[&quot;c&quot;,0,2.67,-0.979,5.253,-2.048,9.079]<\/code> \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u2013 \u044d\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043a\u0440\u0438\u0432\u044b\u0445. \u0418 \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u0438\u0445 \u043a\u0440\u0438\u0432\u044b\u0445 \u0441\u043e\u0442\u043d\u0438 \u0438\u043b\u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043c\u0435\u0442\u043e\u0434 <code>fabric.Canvas#toDatalessJSON<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c:<\/p>\n<pre><code class=\"javascript\">canvas.item(0).sourcePath = '\/assets\/dragon.svg'; console.log(JSON.stringify(canvas.toDatalessJSON())); <\/code><\/pre>\n<p>  \u2026 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c:<\/p>\n<pre><code class=\"javascript\">{&quot;objects&quot;:[{&quot;type&quot;:&quot;path&quot;,&quot;left&quot;:143,&quot;top&quot;:143,&quot;width&quot;:175,&quot;height&quot;:151,&quot;fill&quot;:&quot;#231F20&quot;,&quot;overlayFill&quot;:null,&quot;stroke&quot;:null,&quot;strokeWidth&quot;:1,&quot;strokeDashArray&quot;:null,&quot;scaleX&quot;:1,&quot;scaleY&quot;:1,&quot;angle&quot;:-19,&quot;flipX&quot;:false,&quot;flipY&quot;:false,&quot;opacity&quot;:1,&quot;selectable&quot;:true,&quot;hasControls&quot;:true,&quot;hasBorders&quot;:true,&quot;hasRotatingPoint&quot;:false,&quot;transparentCorners&quot;:true,&quot;perPixelTargetFind&quot;:false,&quot;path&quot;:&quot;\/assets\/dragon.svg&quot;}],&quot;background&quot;:&quot;rgba(0, 0, 0, 0)&quot;} <\/code><\/pre>\n<p>  \u041d\u0443 \u0447\u0442\u043e \u0436, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435! \u0427\u0442\u043e \u0436\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438? \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <code>toDatalessJSON<\/code> \u043c\u044b \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u00absourcePath\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 path (dragon shape) \u0437\u0430\u0434\u0430\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &quot;\/assets\/dragon.svg&quot;. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>toDatalessJSON<\/code>, \u0438 \u0432\u0441\u044f \u044d\u0442\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f path \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 &quot;\/assets\/dragon.svg&quot;. <\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0444\u043e\u0440\u043c, <code>toDatalessJSON<\/code> \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 canvas, \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 path \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 SVG.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>loadFromDatalessJSON<\/code>, \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c canvas \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 (dataless). <code>loadFromDatalessJSON<\/code> \u0443\u043c\u0435\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u00abpath\u00bb \u0441\u0442\u0440\u043e\u043a\u0438 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a &quot;\/assets\/dragon.svg&quot;) \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f path \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 SVG. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 URL:<\/p>\n<pre><code class=\"javascript\">fabric.loadSVGFromString('...', function(objects, options) {   var obj = fabric.util.groupSVGElements(objects, options);   canvas.add(obj).renderAll(); }); <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u044d\u0442\u043e SVG \u0441\u0442\u0440\u043e\u043a\u0430, \u0432\u0442\u043e\u0440\u043e\u0439 \u2013 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043b\u043b\u0431\u044d\u043a. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 SVG \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: <code>objects<\/code> \u0438 <code>options<\/code>. <code>objects<\/code> \u2013 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 SVG \u2013 paths, \u0433\u0440\u0443\u043f\u043f\u0430 path-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432), \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0435\u043a\u0441\u0442 \u0438 \u0442.\u0434. \u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u0438\u043c\u0438 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0432 SVG \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>fabric.util.groupSVGElements<\/code> \u043a\u0430\u043a \u0434\u043b\u044f <code>objects<\/code>, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0438 <code>options<\/code>. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <code>fabric.Path<\/code> \u043b\u0438\u0431\u043e <code>fabric.PathGroup<\/code> \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 canvas.<\/p>\n<p>  <code>fabric.loadSVGFromURL<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e URL, \u0430 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 SVG. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e Fabric \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 URL \u0447\u0435\u0440\u0435\u0437 XMLHttpRequest, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 SVG \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c SOP.<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b (Subclassing)<\/h2>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a Fabric \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u041e\u041e\u041f, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u00ab\u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b\u00bb \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438 \u043d\u0435\u043f\u0440\u0438\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u043e. \u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0438, \u0432 Fabric \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412\u0441\u0435 2D \u043e\u0431\u044a\u0435\u043a\u0442\u044b (path, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0435\u043a\u0441\u0442, \u0438 \u0442.\u0434.) \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043e\u0442 <code>fabric.Object<\/code>, \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u043a\u043b\u0430\u0441\u0441\u044b\u00bb \u2014 \u0432\u0440\u043e\u0434\u0435 <code>fabric.PathGroup<\/code> \u2014 \u0434\u0430\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 3-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>  \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u00ab\u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u00bb \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u00ab\u043a\u043b\u0430\u0441\u0441\u0435\u00bb \u0432 Fabric? \u0418\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb?<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>fabric.util.createClass<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432 javascript. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb Point:<\/p>\n<pre><code class=\"javascript\">var Point = fabric.util.createClass({   initialize: function(x, y) {     this.x = x || 0;     this.y = y || 0;   },   toString: function() {     return this.x + '\/' + this.y;   } }); <\/code><\/pre>\n<p>  <code>createClass<\/code> \u0431\u0435\u0440\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u0430\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u00bb. &#187;initialize&#187; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c Point, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 &#187;x&#187;, &#187;y&#187; \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c &#187;toString&#187;:<\/p>\n<pre><code class=\"javascript\">var point = new Point(10, 20);  point.x; \/\/ 10 point.y; \/\/ 20  point.toString(); \/\/ &quot;10\/20&quot; <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043e\u043a \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u00bb Point, \u0441\u043a\u0430\u0436\u0435\u043c, \u0446\u0432\u0435\u0442\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 (colored point), \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>createClass<\/code>:<\/p>\n<pre><code class=\"javascript\">var ColoredPoint = fabric.util.createClass(Point, {   initialize: function(x, y, color) {     this.callSuper('initialize', x, y);     this.color = color || '#000';   },   toString: function() {     return this.callSuper('toString') + ' (color: ' + this.color + ')';   } }); <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0430 \u043f\u0435\u0440\u0432\u044b\u043c \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb Point, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>callSuper<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u00ab\u043a\u043b\u0430\u0441\u0441\u0435\u00bb. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043c Point, \u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u043d\u0443\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0438 <code>ColoredPoint<\/code>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"javascript\">var redPoint = new ColoredPoint(15, 33, '#f55');  redPoint.x; \/\/ 15 redPoint.y; \/\/ 33 redPoint.color; \/\/ &quot;#f55&quot;  redPoint.toString(); &quot;15\/35 (color: #f55)&quot; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u00ab\u043a\u043b\u0430\u0441\u0441\u044b\u00bb \u0438 \u00ab\u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b\u00bb, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 Fabric. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb <code>LabeledRect<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043d\u0430\u0434\u043f\u0438\u0441\u044c\u044e. \u041a\u043e\u0433\u0434\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u00bb \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u043d\u0430 canvas, \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 (\u043a\u0440\u0443\u0433 \u0438 \u0442\u0435\u043a\u0441\u0442) \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0432 \u0433\u043b\u0430\u0432\u0435 &#8216;\u0413\u0440\u0443\u043f\u043f\u044b&#8217;. \u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 Fabric \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0433\u0440\u0443\u043f\u043f, \u0442\u0430\u043a \u0438 \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438\u00bb.<\/p>\n<pre><code class=\"javascript\">var LabeledRect = fabric.util.createClass(fabric.Rect, {    type: 'labeledRect',    initialize: function(options) {     options || (options = { });      this.callSuper('initialize', options);     this.set('label', options.label || '');   },    toObject: function() {     return fabric.util.object.extend(this.callSuper('toObject'), {       label: this.get('label')     });   },    _render: function(ctx) {     this.callSuper('_render', ctx);      ctx.font = '20px Helvetica';     ctx.fillStyle = '#333';     ctx.fillText(this.label, -this.width\/2, -this.height\/2 + 20);   } }); <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u0443\u0442 \u0432\u0441\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u00ab\u043a\u043b\u0430\u0441\u0441\u00bb \u043a\u0430\u043a <code>fabric.Rect<\/code>, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043a \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u0417\u0430\u0442\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e &#187;type&#187; \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#187;labeledRect&#187;. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 Fabric, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0442\u0430\u043c \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e &#187;type&#187; (\u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043a\u0440\u0443\u0433, path, \u0442\u0435\u043a\u0441\u0442 \u0438 \u0442.\u0434.).<\/p>\n<p>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 (<code>initialize<\/code>) \u043d\u0430\u043c \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c, \u0432 \u043d\u0435\u043c \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>callSuper<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>initialize<\/code> \u043d\u0430 <code>fabric.Rect<\/code>. \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043c\u044b \u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043d\u0430\u0434\u043f\u0438\u0441\u044c (label), \u0432\u0437\u044f\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 <code>options<\/code>. <\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 2 \u043c\u0435\u0442\u043e\u0434\u0430 \u2013 <code>toObject<\/code> \u0438 <code>_render<\/code>. <code>toObject<\/code>, \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0438\u0437 \u0433\u043b\u0430\u0432\u044b \u043f\u0440\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u0435\u043d \u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. <\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a <code>LabeledRect<\/code> \u0438\u043c\u0435\u0435\u0442 \u0442\u0435 \u0436\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0442\u043e \u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (rect), \u043c\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043b\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <code>toObject<\/code>, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0435\u043c\u0443 \u043c\u0435\u0442\u043a\u0443 (label).<\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>_render<\/code>, \u0442\u043e \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (<code>callSuper<\/code>) \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442:<\/p>\n<pre><code class=\"javascript\">var labeledRect = new LabeledRect({   width: 100,   height: 50,   left: 100,   top: 100,   label: 'test',   fill: '#faa' }); canvas.add(labeledRect); <\/code><\/pre>\n<p>  \u2026 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_7.png\" alt=\"image\"\/><\/p>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (label \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443:<\/p>\n<pre><code class=\"javascript\">labeledRect.set({   label: 'trololo',   fill: '#aaf',   rx: 10,   ry: 10 }); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/fabricjs.com\/article_assets\/3_8.png\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u00bb \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u0418\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 <code>toObject<\/code>, \u0438 <code>initialize<\/code>:<\/p>\n<pre><code class=\"javascript\">... initialize: function(options) {   options || (options = { });    this.callSuper('initialize', options);    \/\/ \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0441\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c \u0441 \u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0448\u0438\u0440\u0438\u043d\u0443\/\u0432\u044b\u0441\u043e\u0442\u0443 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 100\/50   this.set({ width: 100, height: 50 });    this.set('label', options.label || ''); } ... _render: function(ctx) {    \/\/ \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0448\u0440\u0438\u0444\u0442 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438   ctx.font = this.labelFont;   ctx.fillStyle = this.labelFill;    ctx.fillText(this.label, -this.width\/2, -this.height\/2 + 20); } ... <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f 3-\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0440\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0433\u0440\u0443\u043f\u043f\u0430\u0445, \u00ab\u043a\u043b\u0430\u0441\u0441\u0430\u0445\u00bb, \u00ab\u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430\u0445\u00bb \u0438 (\u0434\u0435)\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Fabric. \u0415\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0438.<\/p>\n<p>  \u0423\u0441\u043f\u0435\u0445\u043e\u0432 \u0438 \u0443\u0434\u0430\u0447\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438!<\/p>\n<p>  <i>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d \u0441 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0435\u043c \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0443\u0447\u0430\u0441\u0442\u0438\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u043e\u0432. <a href=\"http:\/\/fabricjs.com\/fabric-intro-part-3\/\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/i>. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/254763\/\"> http:\/\/habrahabr.ru\/post\/254763\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p> \t\t\t<i>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 Javascript canvas \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Fabric.js.<\/i><\/p>\n<p>  \u041c\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043e Fabric \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/162367\/\">\u043f\u0435\u0440\u0432\u043e\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167119\/\">\u0432\u0442\u043e\u0440\u043e\u0439 <\/a>\u0447\u0430\u0441\u0442\u044f\u0445 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-254413","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254413"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254413\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}