Skip to content

Commit

Permalink
update demos
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus committed Aug 14, 2024
1 parent 0879181 commit a04b7e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions packages/joint-core/demo/puzzle/src/puzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ joint.dia.Element.define('jigsaw.Piece', {
} , {
attributes: {
tabs: { /* [topTab, rightTab, bottomTab, leftTab] */
qualify: Array.isArray,
set: function(tabs, refBBox) {
if (!Array.isArray(tabs)) return;
var tabSize = this.model.prop('tabSize');
var points = [];
var refCenter = refBBox.center();
Expand All @@ -41,11 +41,12 @@ joint.dia.Element.define('jigsaw.Piece', {
return {
points: points.join(' ').replace(/@/g,' ')
};
}
},
unset: 'points'
},
image: { /* [imageId, rowIndex, columnIndex] */
qualify: Array.isArray,
set: function(image) {
if (!Array.isArray(image)) return;
var paper = this.paper;
var model = this.model;
var width = model.prop('size/width');
Expand All @@ -71,7 +72,8 @@ joint.dia.Element.define('jigsaw.Piece', {
return {
fill: 'url(#' + id + ')'
};
}
},
unset: 'fill'
}
}
});
Expand Down
9 changes: 6 additions & 3 deletions packages/joint-core/demo/rough/src/rough.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@
}
var sets = shape.sets;
return { d: r.opsToPath(sets[opt.fillSketch ? 0 : 1]) };
}
},
unset: 'd'
},
'pointer-shape': {
set: function(type, bbox) {
Expand All @@ -271,7 +272,8 @@
break;
}
return { d: vel.convertToPathData() };
}
},
unset: 'd'
}
}
});
Expand Down Expand Up @@ -323,7 +325,8 @@
bowing: opt.bowing || 1
};
return { d: r.opsToPath(r.generator.path(this.getSerializedConnection(), rOpt).sets[0]) };
}
},
unset: 'd'
}
}
});
Expand Down
7 changes: 3 additions & 4 deletions packages/joint-core/demo/shapes/src/standard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ V.attributeNames['placeholderURL'] = 'placeholderURL';

// Custom attribute for retrieving image placeholder with specific size
dia.attributes.placeholderURL = {
qualify: function(url) {
return typeof url === 'string';
},
set: function(url, refBBox) {
if (typeof url !== 'string') return;
return { 'xlink:href': util.template(url)(refBBox.round().toJSON()) };
}
},
unset: 'xlink:href'
};

var CylinderTiltTool = elementTools.Control.extend({
Expand Down

0 comments on commit a04b7e7

Please sign in to comment.