build and test fix

This commit is contained in:
Anton Lavrenov
2018-08-09 12:35:21 +07:00
parent b518ae0dac
commit 77af92cbf0
3 changed files with 56 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
* Konva JavaScript Framework v2.1.8
* http://konvajs.github.io/
* Licensed under the MIT
* Date: Wed Aug 01 2018
* Date: Thu Aug 09 2018
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@@ -15632,6 +15632,7 @@
* @param {Object} config.animations animation map
* @param {Integer} [config.frameIndex] animation frame index
* @param {Image} config.image image object
* @param {Integer} [config.frameRate] animation frame rate
* @param {String} [config.fill] fill color
* @param {Image} [config.fillPatternImage] fill pattern image
* @param {Number} [config.fillPatternX]
@@ -18709,12 +18710,10 @@
(function(Konva) {
'use strict';
var BASE_BOX_WIDTH = 10;
var BASE_BOX_HEIGHT = 10;
var ATTR_CHANGE_LIST = [
'resizeEnabledChange',
'rotateHandlerOffsetChange'
'rotateHandlerOffsetChange',
'anchorSizeChange'
].join(' ');
var NODE_RECT = 'nodeRect';
@@ -18822,6 +18821,7 @@
* @param {Boolean} [config.keepRatio] Should we keep ratio when we are moving edges? Default is true
* @param {Array} [config.enabledHandlers] Array of names of enabled handles
* @param {Function} [config.boundBoxFunc] Bounding box function
* @param {Number} [config.anchorSize] Default is 10
* @example
* var transformer = new Konva.Transformer({
* node: rectangle,
@@ -19005,17 +19005,17 @@
stroke: 'rgb(0, 161, 255)',
fill: 'white',
strokeWidth: 1,
name: name,
width: BASE_BOX_WIDTH,
height: BASE_BOX_HEIGHT,
offsetX: BASE_BOX_WIDTH / 2,
offsetY: BASE_BOX_HEIGHT / 2,
dragDistance: 0
name: name + ' _anchor',
dragDistance: 0,
draggable: true
});
var self = this;
anchor.on('mousedown touchstart', function(e) {
self._handleMouseDown(e);
});
anchor.on('dragstart', function(e) {
e.cancelBubble = true;
});
// add hover styling
anchor.on('mouseenter', function() {
@@ -19091,7 +19091,7 @@
},
_handleMouseDown: function(e) {
this.movingResizer = e.target.name();
this.movingResizer = e.target.name().split(' ')[0];
// var node = this.getNode();
var attrs = this._getNodeRect();
@@ -19376,6 +19376,14 @@
var resizeEnabled = this.resizeEnabled();
var padding = this.getPadding();
var anchorSize = this.getAnchorSize();
this.find('._anchor').setAttrs({
width: anchorSize,
height: anchorSize,
offsetX: anchorSize / 2,
offsetY: anchorSize / 2
});
this.findOne('.top-left').setAttrs({
x: -padding,
y: -padding,
@@ -19530,6 +19538,38 @@
*/
Konva.Factory.addGetterSetter(Konva.Transformer, 'resizeEnabled', true);
function validateAnchors(val) {
if (isNaN(val)) {
Konva.Util.warn('anchorSize value should be a Number');
}
if (val < 10) {
Konva.Util.warn('Anchor must be a minimum of 10');
return 10;
}
return val;
}
/**
* get/set anchor size. Default is 10
* @name validateAnchors
* @method
* @memberof Konva.Transformer.prototype
* @param {Number} 10
* @returns {Number}
* @example
* // get
* var anchorSize = transformer.anchorSize();
*
* // set
* transformer.anchorSize(20)
*/
Konva.Factory.addGetterSetter(
Konva.Transformer,
'anchorSize',
10,
validateAnchors
);
/**
* get/set ability to rotate.
* @name rotateEnabled

6
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1198,7 +1198,7 @@ suite('Transformer', function() {
x: 20,
y: 20
});
assert.equal(shape.name(), 'top-left');
assert.equal(shape.name(), 'top-left _anchor');
});
test('check rotator size on scaled transformer', function() {