mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 03:53:13 +08:00
update deps, change defualt dragDistance to 3px
This commit is contained in:
parent
2fd798649b
commit
460feab0ae
@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Not released][Not released]
|
||||
|
||||
### Changed
|
||||
- Default value for `dragDistance` is changed to 3px.
|
||||
|
||||
## [1.6.8][2017-08-19]
|
||||
|
||||
### Changed
|
||||
|
215
gulpfile.js
215
gulpfile.js
@ -1,158 +1,167 @@
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
var concat = require('gulp-concat');
|
||||
var replace = require('gulp-replace');
|
||||
var mochaPhantomJS = require('gulp-mocha-phantomjs');
|
||||
var jsdoc = require('gulp-jsdoc');
|
||||
var jsdoc = require('gulp-jsdoc3');
|
||||
var connect = require('gulp-connect');
|
||||
var jscpd = require('gulp-jscpd');
|
||||
var eslint = require('gulp-eslint');
|
||||
|
||||
var fs = require('fs');
|
||||
var NodeParams = fs.readFileSync('./resources/doc-includes/NodeParams.txt').toString();
|
||||
var ContainerParams = fs.readFileSync('./resources/doc-includes/ContainerParams.txt').toString();
|
||||
var ShapeParams = fs.readFileSync('./resources/doc-includes/ShapeParams.txt').toString();
|
||||
var NodeParams = fs
|
||||
.readFileSync('./resources/doc-includes/NodeParams.txt')
|
||||
.toString();
|
||||
var ContainerParams = fs
|
||||
.readFileSync('./resources/doc-includes/ContainerParams.txt')
|
||||
.toString();
|
||||
var ShapeParams = fs
|
||||
.readFileSync('./resources/doc-includes/ShapeParams.txt')
|
||||
.toString();
|
||||
|
||||
var conf = require('./package.json');
|
||||
|
||||
var sourceFiles = [
|
||||
// core
|
||||
'src/Global.js',
|
||||
'src/Util.js',
|
||||
'src/Canvas.js',
|
||||
'src/Context.js',
|
||||
'src/Factory.js',
|
||||
'src/Node.js',
|
||||
// core
|
||||
'src/Global.js',
|
||||
'src/Util.js',
|
||||
'src/Canvas.js',
|
||||
'src/Context.js',
|
||||
'src/Factory.js',
|
||||
'src/Node.js',
|
||||
|
||||
// filters
|
||||
'src/filters/Grayscale.js',
|
||||
'src/filters/Brighten.js',
|
||||
'src/filters/Invert.js',
|
||||
'src/filters/Blur.js',
|
||||
'src/filters/Mask.js',
|
||||
'src/filters/RGB.js',
|
||||
'src/filters/RGBA.js',
|
||||
'src/filters/HSV.js',
|
||||
'src/filters/HSL.js',
|
||||
'src/filters/Emboss.js',
|
||||
'src/filters/Enhance.js',
|
||||
'src/filters/Posterize.js',
|
||||
'src/filters/Noise.js',
|
||||
'src/filters/Pixelate.js',
|
||||
'src/filters/Threshold.js',
|
||||
'src/filters/Sepia.js',
|
||||
'src/filters/Solarize.js',
|
||||
'src/filters/Kaleidoscope.js',
|
||||
// filters
|
||||
'src/filters/Grayscale.js',
|
||||
'src/filters/Brighten.js',
|
||||
'src/filters/Invert.js',
|
||||
'src/filters/Blur.js',
|
||||
'src/filters/Mask.js',
|
||||
'src/filters/RGB.js',
|
||||
'src/filters/RGBA.js',
|
||||
'src/filters/HSV.js',
|
||||
'src/filters/HSL.js',
|
||||
'src/filters/Emboss.js',
|
||||
'src/filters/Enhance.js',
|
||||
'src/filters/Posterize.js',
|
||||
'src/filters/Noise.js',
|
||||
'src/filters/Pixelate.js',
|
||||
'src/filters/Threshold.js',
|
||||
'src/filters/Sepia.js',
|
||||
'src/filters/Solarize.js',
|
||||
'src/filters/Kaleidoscope.js',
|
||||
|
||||
// core
|
||||
'src/Container.js',
|
||||
'src/Shape.js',
|
||||
'src/Stage.js',
|
||||
'src/BaseLayer.js',
|
||||
'src/Layer.js',
|
||||
'src/FastLayer.js',
|
||||
'src/Group.js',
|
||||
'src/Animation.js',
|
||||
'src/Tween.js',
|
||||
'src/DragAndDrop.js',
|
||||
// core
|
||||
'src/Container.js',
|
||||
'src/Shape.js',
|
||||
'src/Stage.js',
|
||||
'src/BaseLayer.js',
|
||||
'src/Layer.js',
|
||||
'src/FastLayer.js',
|
||||
'src/Group.js',
|
||||
'src/Animation.js',
|
||||
'src/Tween.js',
|
||||
'src/DragAndDrop.js',
|
||||
|
||||
// shapes
|
||||
'src/shapes/Rect.js',
|
||||
'src/shapes/Circle.js',
|
||||
'src/shapes/Ellipse.js',
|
||||
'src/shapes/Ring.js',
|
||||
'src/shapes/Wedge.js',
|
||||
'src/shapes/Arc.js',
|
||||
'src/shapes/Image.js',
|
||||
'src/shapes/Text.js',
|
||||
'src/shapes/Line.js',
|
||||
'src/shapes/Sprite.js',
|
||||
'src/shapes/Path.js',
|
||||
'src/shapes/TextPath.js',
|
||||
'src/shapes/RegularPolygon.js',
|
||||
'src/shapes/Star.js',
|
||||
'src/shapes/Label.js',
|
||||
'src/shapes/Arrow.js'
|
||||
// shapes
|
||||
'src/shapes/Rect.js',
|
||||
'src/shapes/Circle.js',
|
||||
'src/shapes/Ellipse.js',
|
||||
'src/shapes/Ring.js',
|
||||
'src/shapes/Wedge.js',
|
||||
'src/shapes/Arc.js',
|
||||
'src/shapes/Image.js',
|
||||
'src/shapes/Text.js',
|
||||
'src/shapes/Line.js',
|
||||
'src/shapes/Sprite.js',
|
||||
'src/shapes/Path.js',
|
||||
'src/shapes/TextPath.js',
|
||||
'src/shapes/RegularPolygon.js',
|
||||
'src/shapes/Star.js',
|
||||
'src/shapes/Label.js',
|
||||
'src/shapes/Arrow.js'
|
||||
];
|
||||
|
||||
function build() {
|
||||
return gulp.src(sourceFiles)
|
||||
.pipe(concat('konva-dev.js'))
|
||||
.pipe(replace('@@shapeParams', ShapeParams))
|
||||
.pipe(replace('@@nodeParams', NodeParams))
|
||||
.pipe(replace('@@containerParams', ContainerParams))
|
||||
.pipe(replace('@@version', conf.version))
|
||||
.pipe(replace('@@date', new Date().toDateString()));
|
||||
return gulp
|
||||
.src(sourceFiles)
|
||||
.pipe(concat('konva-dev.js'))
|
||||
.pipe(replace('@@shapeParams', ShapeParams))
|
||||
.pipe(replace('@@nodeParams', NodeParams))
|
||||
.pipe(replace('@@containerParams', ContainerParams))
|
||||
.pipe(replace('@@version', conf.version))
|
||||
.pipe(replace('@@date', new Date().toDateString()));
|
||||
}
|
||||
|
||||
|
||||
// create development build
|
||||
gulp.task('dev-build', function() {
|
||||
return build()
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
return build().pipe(gulp.dest('./dist/'));
|
||||
});
|
||||
|
||||
|
||||
// create usual build konva.js and konva.min.js
|
||||
gulp.task('build', function() {
|
||||
return build()
|
||||
.pipe(rename('konva.js'))
|
||||
.pipe(gulp.dest('./'))
|
||||
.pipe(uglify({
|
||||
preserveComments: 'some'
|
||||
}))
|
||||
.pipe(rename('konva.min.js'))
|
||||
.pipe(gulp.dest('./'));
|
||||
return build()
|
||||
.pipe(rename('konva.js'))
|
||||
.pipe(gulp.dest('./'))
|
||||
.pipe(
|
||||
uglify({
|
||||
preserveComments: 'some'
|
||||
})
|
||||
)
|
||||
.pipe(rename('konva.min.js'))
|
||||
.pipe(gulp.dest('./'));
|
||||
});
|
||||
|
||||
// tun tests
|
||||
gulp.task('test', ['dev-build'], function () {
|
||||
return gulp
|
||||
.src('test/runner.html')
|
||||
.pipe(mochaPhantomJS());
|
||||
gulp.task('test', ['dev-build'], function() {
|
||||
return gulp.src('test/runner.html').pipe(mochaPhantomJS());
|
||||
});
|
||||
|
||||
// local server for better development
|
||||
gulp.task('server', function() {
|
||||
connect.server();
|
||||
connect.server();
|
||||
});
|
||||
|
||||
// lint files
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src('./src/**/*.js')
|
||||
.pipe(eslint({
|
||||
configFile: './.eslintrc'
|
||||
}))
|
||||
// eslint.format() outputs the lint results to the console.
|
||||
// Alternatively use eslint.formatEach() (see Docs).
|
||||
.pipe(eslint.format())
|
||||
// To have the process exit with an error code (1) on
|
||||
// lint error, return the stream and pipe to failOnError last.
|
||||
.pipe(eslint.failOnError());
|
||||
return (gulp
|
||||
.src('./src/**/*.js')
|
||||
.pipe(
|
||||
eslint({
|
||||
configFile: './.eslintrc'
|
||||
})
|
||||
)
|
||||
// eslint.format() outputs the lint results to the console.
|
||||
// Alternatively use eslint.formatEach() (see Docs).
|
||||
.pipe(eslint.format())
|
||||
// To have the process exit with an error code (1) on
|
||||
// lint error, return the stream and pipe to failOnError last.
|
||||
.pipe(eslint.failOnError()) );
|
||||
});
|
||||
|
||||
// check code for duplication
|
||||
gulp.task('inspect', function() {
|
||||
return gulp.src('./src/**/*.js')
|
||||
.pipe(jscpd({
|
||||
return gulp.src('./src/**/*.js').pipe(
|
||||
jscpd({
|
||||
'min-lines': 10,
|
||||
verbose: true
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// generate documentation
|
||||
// // generate documentation
|
||||
gulp.task('api', function() {
|
||||
return gulp.src('./src/**/*.js')
|
||||
.pipe(jsdoc('./api'));
|
||||
return gulp.src('./src/**/*.js').pipe(
|
||||
jsdoc({
|
||||
opts: {
|
||||
destination: './api'
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch(['src/**/*.js'], ['dev-build']);
|
||||
gulp.watch(['src/**/*.js'], ['dev-build']);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('default', ['dev-build', 'watch', 'server']);
|
||||
|
136
konva.js
136
konva.js
@ -2,7 +2,7 @@
|
||||
* Konva JavaScript Framework v1.6.8
|
||||
* http://konvajs.github.io/
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Sat Aug 19 2017
|
||||
* Date: Thu Aug 24 2017
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - 2017 by Anton Lavrenov (Konva)
|
||||
@ -10567,7 +10567,7 @@
|
||||
*/
|
||||
})();
|
||||
|
||||
(function() {
|
||||
(function(Konva) {
|
||||
'use strict';
|
||||
/**
|
||||
* BaseLayer constructor.
|
||||
@ -10604,8 +10604,6 @@
|
||||
* @param {Number} [config.clipHeight] set clip height
|
||||
* @param {Function} [config.clipFunc] set clip func
|
||||
|
||||
* @example
|
||||
* var layer = new Konva.Layer();
|
||||
*/
|
||||
Konva.BaseLayer = function(config) {
|
||||
this.___init(config);
|
||||
@ -10620,47 +10618,47 @@
|
||||
return this.canvas._canvas.createPNGStream();
|
||||
},
|
||||
/**
|
||||
* get layer canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getCanvas: function() {
|
||||
return this.canvas;
|
||||
},
|
||||
/**
|
||||
* get layer hit canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer hit canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getHitCanvas: function() {
|
||||
return this.hitCanvas;
|
||||
},
|
||||
/**
|
||||
* get layer canvas context
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer canvas context
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getContext: function() {
|
||||
return this.getCanvas().getContext();
|
||||
},
|
||||
/**
|
||||
* clear scene and hit canvas contexts tied to the layer
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Object} [bounds]
|
||||
* @param {Number} [bounds.x]
|
||||
* @param {Number} [bounds.y]
|
||||
* @param {Number} [bounds.width]
|
||||
* @param {Number} [bounds.height]
|
||||
* @example
|
||||
* layer.clear();
|
||||
* layer.clear({
|
||||
* x : 0,
|
||||
* y : 0,
|
||||
* width : 100,
|
||||
* height : 100
|
||||
* });
|
||||
*/
|
||||
* clear scene and hit canvas contexts tied to the layer
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Object} [bounds]
|
||||
* @param {Number} [bounds.x]
|
||||
* @param {Number} [bounds.y]
|
||||
* @param {Number} [bounds.width]
|
||||
* @param {Number} [bounds.height]
|
||||
* @example
|
||||
* layer.clear();
|
||||
* layer.clear({
|
||||
* x : 0,
|
||||
* y : 0,
|
||||
* width : 100,
|
||||
* height : 100
|
||||
* });
|
||||
*/
|
||||
clear: function(bounds) {
|
||||
this.getContext().clear(bounds);
|
||||
return this;
|
||||
@ -10769,15 +10767,15 @@
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get/set width of layer.getter return width of stage. setter doing nothing.
|
||||
* if you want change width use `stage.width(value);`
|
||||
* @name width
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var width = layer.width();
|
||||
*/
|
||||
* get/set width of layer.getter return width of stage. setter doing nothing.
|
||||
* if you want change width use `stage.width(value);`
|
||||
* @name width
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var width = layer.width();
|
||||
*/
|
||||
getWidth: function() {
|
||||
if (this.parent) {
|
||||
return this.parent.getWidth();
|
||||
@ -10789,15 +10787,15 @@
|
||||
);
|
||||
},
|
||||
/**
|
||||
* get/set height of layer.getter return height of stage. setter doing nothing.
|
||||
* if you want change height use `stage.height(value);`
|
||||
* @name height
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var height = layer.height();
|
||||
*/
|
||||
* get/set height of layer.getter return height of stage. setter doing nothing.
|
||||
* if you want change height use `stage.height(value);`
|
||||
* @name height
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var height = layer.height();
|
||||
*/
|
||||
getHeight: function() {
|
||||
if (this.parent) {
|
||||
return this.parent.getHeight();
|
||||
@ -10821,26 +10819,26 @@
|
||||
// add getters and setters
|
||||
Konva.Factory.addGetterSetter(Konva.BaseLayer, 'clearBeforeDraw', true);
|
||||
/**
|
||||
* get/set clearBeforeDraw flag which determines if the layer is cleared or not
|
||||
* before drawing
|
||||
* @name clearBeforeDraw
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Boolean} clearBeforeDraw
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get clearBeforeDraw flag
|
||||
* var clearBeforeDraw = layer.clearBeforeDraw();
|
||||
*
|
||||
* // disable clear before draw
|
||||
* layer.clearBeforeDraw(false);
|
||||
*
|
||||
* // enable clear before draw
|
||||
* layer.clearBeforeDraw(true);
|
||||
*/
|
||||
* get/set clearBeforeDraw flag which determines if the layer is cleared or not
|
||||
* before drawing
|
||||
* @name clearBeforeDraw
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Boolean} clearBeforeDraw
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get clearBeforeDraw flag
|
||||
* var clearBeforeDraw = layer.clearBeforeDraw();
|
||||
*
|
||||
* // disable clear before draw
|
||||
* layer.clearBeforeDraw(false);
|
||||
*
|
||||
* // enable clear before draw
|
||||
* layer.clearBeforeDraw(true);
|
||||
*/
|
||||
|
||||
Konva.Collection.mapMethods(Konva.BaseLayer);
|
||||
})();
|
||||
})(Konva);
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
12
konva.min.js
vendored
12
konva.min.js
vendored
File diff suppressed because one or more lines are too long
31
package.json
31
package.json
@ -2,13 +2,7 @@
|
||||
"name": "konva",
|
||||
"version": "1.6.8",
|
||||
"author": "Anton Lavrenov",
|
||||
"files": [
|
||||
"README.md",
|
||||
"konva.js",
|
||||
"konva.min.js",
|
||||
"src",
|
||||
"konva.d.ts"
|
||||
],
|
||||
"files": ["README.md", "konva.js", "konva.min.js", "src", "konva.d.ts"],
|
||||
"main": "konva.js",
|
||||
"typings": "./konva.d.ts",
|
||||
"scripts": {
|
||||
@ -20,27 +14,22 @@
|
||||
"prettier": "prettier --write \"src/**/*.js\" \"test/**/*.js\" --single-quote"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "3.5.0",
|
||||
"chai": "4.1.1",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-connect": "^5.0.0",
|
||||
"gulp-eslint": "^3.0.1",
|
||||
"gulp-jscpd": "0.0.7",
|
||||
"gulp-jsdoc": "^0.1.5",
|
||||
"gulp-eslint": "^4.0.0",
|
||||
"gulp-jscpd": "0.0.8",
|
||||
"gulp-jsdoc3": "^1.0.1",
|
||||
"gulp-mocha-phantomjs": "^0.12.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-uglify": "^2.1.2",
|
||||
"gulp-replace": "^0.6.1",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"gulp-util": "^3.0.8",
|
||||
"mocha": "3.3.0",
|
||||
"prettier": "^1.2.2"
|
||||
"mocha": "3.5.0",
|
||||
"prettier": "^1.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"canvas",
|
||||
"animations",
|
||||
"graphic",
|
||||
"html5"
|
||||
],
|
||||
"keywords": ["canvas", "animations", "graphic", "html5"],
|
||||
"browser": {
|
||||
"canvas": false,
|
||||
"jsdom": false
|
||||
|
134
src/BaseLayer.js
134
src/BaseLayer.js
@ -1,4 +1,4 @@
|
||||
(function() {
|
||||
(function(Konva) {
|
||||
'use strict';
|
||||
/**
|
||||
* BaseLayer constructor.
|
||||
@ -10,8 +10,6 @@
|
||||
* to clear the canvas before each layer draw. The default value is true.
|
||||
* @@nodeParams
|
||||
* @@containerParams
|
||||
* @example
|
||||
* var layer = new Konva.Layer();
|
||||
*/
|
||||
Konva.BaseLayer = function(config) {
|
||||
this.___init(config);
|
||||
@ -26,47 +24,47 @@
|
||||
return this.canvas._canvas.createPNGStream();
|
||||
},
|
||||
/**
|
||||
* get layer canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getCanvas: function() {
|
||||
return this.canvas;
|
||||
},
|
||||
/**
|
||||
* get layer hit canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer hit canvas
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getHitCanvas: function() {
|
||||
return this.hitCanvas;
|
||||
},
|
||||
/**
|
||||
* get layer canvas context
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
* get layer canvas context
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
*/
|
||||
getContext: function() {
|
||||
return this.getCanvas().getContext();
|
||||
},
|
||||
/**
|
||||
* clear scene and hit canvas contexts tied to the layer
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Object} [bounds]
|
||||
* @param {Number} [bounds.x]
|
||||
* @param {Number} [bounds.y]
|
||||
* @param {Number} [bounds.width]
|
||||
* @param {Number} [bounds.height]
|
||||
* @example
|
||||
* layer.clear();
|
||||
* layer.clear({
|
||||
* x : 0,
|
||||
* y : 0,
|
||||
* width : 100,
|
||||
* height : 100
|
||||
* });
|
||||
*/
|
||||
* clear scene and hit canvas contexts tied to the layer
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Object} [bounds]
|
||||
* @param {Number} [bounds.x]
|
||||
* @param {Number} [bounds.y]
|
||||
* @param {Number} [bounds.width]
|
||||
* @param {Number} [bounds.height]
|
||||
* @example
|
||||
* layer.clear();
|
||||
* layer.clear({
|
||||
* x : 0,
|
||||
* y : 0,
|
||||
* width : 100,
|
||||
* height : 100
|
||||
* });
|
||||
*/
|
||||
clear: function(bounds) {
|
||||
this.getContext().clear(bounds);
|
||||
return this;
|
||||
@ -175,15 +173,15 @@
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get/set width of layer.getter return width of stage. setter doing nothing.
|
||||
* if you want change width use `stage.width(value);`
|
||||
* @name width
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var width = layer.width();
|
||||
*/
|
||||
* get/set width of layer.getter return width of stage. setter doing nothing.
|
||||
* if you want change width use `stage.width(value);`
|
||||
* @name width
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var width = layer.width();
|
||||
*/
|
||||
getWidth: function() {
|
||||
if (this.parent) {
|
||||
return this.parent.getWidth();
|
||||
@ -195,15 +193,15 @@
|
||||
);
|
||||
},
|
||||
/**
|
||||
* get/set height of layer.getter return height of stage. setter doing nothing.
|
||||
* if you want change height use `stage.height(value);`
|
||||
* @name height
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var height = layer.height();
|
||||
*/
|
||||
* get/set height of layer.getter return height of stage. setter doing nothing.
|
||||
* if you want change height use `stage.height(value);`
|
||||
* @name height
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* var height = layer.height();
|
||||
*/
|
||||
getHeight: function() {
|
||||
if (this.parent) {
|
||||
return this.parent.getHeight();
|
||||
@ -227,23 +225,23 @@
|
||||
// add getters and setters
|
||||
Konva.Factory.addGetterSetter(Konva.BaseLayer, 'clearBeforeDraw', true);
|
||||
/**
|
||||
* get/set clearBeforeDraw flag which determines if the layer is cleared or not
|
||||
* before drawing
|
||||
* @name clearBeforeDraw
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Boolean} clearBeforeDraw
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get clearBeforeDraw flag
|
||||
* var clearBeforeDraw = layer.clearBeforeDraw();
|
||||
*
|
||||
* // disable clear before draw
|
||||
* layer.clearBeforeDraw(false);
|
||||
*
|
||||
* // enable clear before draw
|
||||
* layer.clearBeforeDraw(true);
|
||||
*/
|
||||
* get/set clearBeforeDraw flag which determines if the layer is cleared or not
|
||||
* before drawing
|
||||
* @name clearBeforeDraw
|
||||
* @method
|
||||
* @memberof Konva.BaseLayer.prototype
|
||||
* @param {Boolean} clearBeforeDraw
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get clearBeforeDraw flag
|
||||
* var clearBeforeDraw = layer.clearBeforeDraw();
|
||||
*
|
||||
* // disable clear before draw
|
||||
* layer.clearBeforeDraw(false);
|
||||
*
|
||||
* // enable clear before draw
|
||||
* layer.clearBeforeDraw(true);
|
||||
*/
|
||||
|
||||
Konva.Collection.mapMethods(Konva.BaseLayer);
|
||||
})();
|
||||
})(Konva);
|
||||
|
@ -65,14 +65,14 @@
|
||||
pixelRatio: undefined,
|
||||
/**
|
||||
* Drag distance property. If you start to drag a node you may want to wait until pointer is moved to some distance from start point,
|
||||
* only then start dragging.
|
||||
* only then start dragging. Default is 3px.
|
||||
* @property dragDistance
|
||||
* @default 0
|
||||
* @memberof Konva
|
||||
* @example
|
||||
* Konva.dragDistance = 10;
|
||||
*/
|
||||
dragDistance: 0,
|
||||
dragDistance: 3,
|
||||
/**
|
||||
* Use degree values for angle properties. You may set this property to false if you want to use radiant values.
|
||||
* @property angleDeg
|
||||
|
@ -1712,7 +1712,7 @@ suite('Node', function() {
|
||||
layer.add(rect1).add(group);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(rect1.dragDistance(), 0);
|
||||
assert.equal(rect1.dragDistance(), Konva.dragDistance);
|
||||
assert.equal(group.dragDistance(), 2);
|
||||
assert.equal(rect2.dragDistance(), 2);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user