mirror of
https://github.com/konvajs/konva.git
synced 2025-12-04 10:58:22 +08:00
decided that the developer should be responsible for setting custom drawing functions, images, and event handlers via selectors rather than a hash map passed into the load() method
This commit is contained in:
11
dist/kinetic-core.js
vendored
11
dist/kinetic-core.js
vendored
@@ -1142,13 +1142,8 @@ Kinetic.Stage.prototype = {
|
||||
/**
|
||||
* load stage with JSON string
|
||||
*/
|
||||
load: function(json, drawFuncs) {
|
||||
load: function(json) {
|
||||
function loadNode(node, obj) {
|
||||
// if custom shape then set draw function
|
||||
if(obj.nodeType === 'Shape' && obj.shapeType === undefined) {
|
||||
node.drawFunc = drawFuncs[obj.attrs.drawFuncName];
|
||||
}
|
||||
|
||||
var children = obj.children;
|
||||
if(children !== undefined) {
|
||||
for(var n = 0; n < children.length; n++) {
|
||||
@@ -1932,7 +1927,7 @@ Kinetic.Shape = function(config) {
|
||||
|
||||
// special
|
||||
this.drawFunc = config.drawFunc;
|
||||
|
||||
|
||||
this.data = [];
|
||||
this.nodeType = 'Shape';
|
||||
|
||||
@@ -2079,7 +2074,7 @@ Kinetic.Shape.prototype = {
|
||||
* @param {Layer} layer Layer that the shape will be drawn on
|
||||
*/
|
||||
_draw: function(layer) {
|
||||
if(this.attrs.visible) {
|
||||
if(this.attrs.visible && this.drawFunc !== undefined) {
|
||||
var stage = layer.getStage();
|
||||
var context = layer.getContext();
|
||||
var family = [];
|
||||
|
||||
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user