Skip to content

Commit

Permalink
Updated some demos and the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaroskappler committed Dec 11, 2019
1 parent c40b6ca commit f1eb15f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Changelog
* 2019-12-11
* Added the 'color' param to the draw.label(...) function.
* Fixed the draggable-intersection-point issue in the line-point-distance demo.
* Added a working bark-beetle-tunnel demo to the line-point-distance demo. There was an odering problem.
* 2019-12-09
* Fixed the Triangle.determinant() function. The calculation was just wrong.
* Removed an unnecesary if-condition from the VoronoiCell._calculateOpenEdgePoint(...) helper function.
Expand Down
2 changes: 1 addition & 1 deletion demos/02-line-point-distance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
perpendicular.b.attr.selectable = perpendicular.b.attr.draggable = false;
pb.add( perpendicular );
var intersection = randomVertex();
intersection.attr.selectable = perpendicular.a.attr.draggable = false;
intersection.attr.selectable = intersection.attr.draggable = false;
pb.add( intersection );


Expand Down
28 changes: 17 additions & 11 deletions dist/plotboilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4673,7 +4673,8 @@ Object.extendClass = function( superClass, subClass ) {
* @modified 2019-11-22 Added a second workaround for th drawImage bug in Safari.
* @modified 2019-12-07 Added the 'lineWidth' param to the line(...) function.
* @modified 2019-12-07 Added the 'lineWidth' param to the cubicBezier(...) function.
* @version 1.3.2
* @modified 2019-12-11 Added the 'color' param to the label(...) function.
* @version 1.4.0
**/

(function(_context) {
Expand Down Expand Up @@ -5346,42 +5347,47 @@ Object.extendClass = function( superClass, subClass ) {


// THIS FUNCTION IS CURRENTLY NOT IN USE
// TODO: make text scaling with zoom?
/*
_context.drawutils.prototype.text = function( text, x, y ) { // , options ) {
//options = options || {};
_context.drawutils.prototype.text = function( text, x, y, options ) {
options = options || {};
//this.ctx.save();
x = this.offset.x+x*this.scale.x;
y = this.offset.y+y*this.scale.y;
var color = options.color || 'black';
if( this.fillShapes ) {
this.ctx.fillStyle = 'black';
this.ctx.fillStyle = color;
this.ctx.fillText( text, x, y );
} else {
this.ctx.strokeStyle = 'black';
this.ctx.strokeStyle = color;
this.ctx.strokeText( text, x, y );
}
//this.ctx.restore();
};
*/



/**
* Draw a non-scaling text label at the given position.
*
* Note that these are absolute label positions, they are not affected by offset or scale.
*
* @method label
* @param {string} text - The text to draw.
* @param {number} x - The x-position to draw the text at.
* @param {number} y - The y-position to draw the text at.
* @param {number=} rotation - The (aoptional) rotation in radians.
* @param {string='black'} color - The color to render the text with.
* @return {void}
* @instance
* @memberof drawutils
*/
// +---------------------------------------------------------------------------------
// | Draw a non-scaling text label at the given position.
// +-------------------------------
_context.drawutils.prototype.label = function( text, x, y, rotation ) {
_context.drawutils.prototype.label = function( text, x, y, rotation, color ) {
this.ctx.save();
this.ctx.translate(x, y);
if( typeof rotation != 'undefined' )
this.ctx.rotate(rotation);
this.ctx.fillStyle = 'black';
this.ctx.fillStyle = color || 'black';
if( this.fillShapes ) {
this.ctx.fillText( text, 0,0);
} else {
Expand Down
4 changes: 2 additions & 2 deletions dist/plotboilerplate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi


echo "Publish ..."
# npm publish
npm publish

echo ""
echo " !!! Don't forget to upload the compiled package to your staging environment !!!"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f1eb15f

Please sign in to comment.