mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
capture events for transformer
This commit is contained in:
parent
824261ee6f
commit
e53d75b11f
79
konva.js
79
konva.js
@ -2,7 +2,7 @@
|
||||
* Konva JavaScript Framework v2.0.2
|
||||
* http://konvajs.github.io/
|
||||
* Licensed under the MIT
|
||||
* Date: Wed Apr 11 2018
|
||||
* Date: Tue Apr 17 2018
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
||||
@ -6412,13 +6412,13 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name hue
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} hue value between 0 and 359
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name hue
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} hue value between 0 and 359
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(
|
||||
Konva.Node,
|
||||
@ -6428,13 +6428,13 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name saturation
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name saturation
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(
|
||||
Konva.Node,
|
||||
@ -6444,24 +6444,24 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter.
|
||||
* @name value
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} value 0 is no change, -1.0 halves the value, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter.
|
||||
* @name value
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} value from -1 to 1
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
/**
|
||||
* HSL Filter. Adjusts the hue, saturation and luminance (or lightness)
|
||||
* @function
|
||||
* @memberof Konva.Filters
|
||||
* @param {Object} imageData
|
||||
* @author ippo615
|
||||
* @example
|
||||
* image.filters([Konva.Filters.HSL]);
|
||||
* image.luminance(200);
|
||||
*/
|
||||
* HSL Filter. Adjusts the hue, saturation and luminance (or lightness)
|
||||
* @function
|
||||
* @memberof Konva.Filters
|
||||
* @param {Object} imageData
|
||||
* @author ippo615
|
||||
* @example
|
||||
* image.filters([Konva.Filters.HSL]);
|
||||
* image.luminance(200);
|
||||
*/
|
||||
|
||||
Konva.Filters.HSL = function(imageData) {
|
||||
var data = imageData.data,
|
||||
@ -6488,14 +6488,14 @@
|
||||
vsw = v * s * Math.sin(h * Math.PI / 180);
|
||||
// (result spot)(source spot)
|
||||
var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw,
|
||||
rg = 0.587 * v - 0.587 * vsu + 0.330 * vsw,
|
||||
rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw,
|
||||
rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
|
||||
var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw,
|
||||
gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw,
|
||||
gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
|
||||
var br = 0.299 * v - 0.300 * vsu + 1.250 * vsw,
|
||||
bg = 0.587 * v - 0.586 * vsu - 1.050 * vsw,
|
||||
bb = 0.114 * v + 0.886 * vsu - 0.200 * vsw;
|
||||
var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw,
|
||||
bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw,
|
||||
bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
|
||||
|
||||
var r, g, b, a;
|
||||
|
||||
@ -18978,8 +18978,8 @@
|
||||
|
||||
window.addEventListener('mousemove', this._handleMouseMove);
|
||||
window.addEventListener('touchmove', this._handleMouseMove);
|
||||
window.addEventListener('mouseup', this._handleMouseUp);
|
||||
window.addEventListener('touchend', this._handleMouseUp);
|
||||
window.addEventListener('mouseup', this._handleMouseUp, true);
|
||||
window.addEventListener('touchend', this._handleMouseUp, true);
|
||||
|
||||
this._transforming = true;
|
||||
|
||||
@ -19179,8 +19179,8 @@
|
||||
this._transforming = false;
|
||||
window.removeEventListener('mousemove', this._handleMouseMove);
|
||||
window.removeEventListener('touchmove', this._handleMouseMove);
|
||||
window.removeEventListener('mouseup', this._handleMouseUp);
|
||||
window.removeEventListener('touchend', this._handleMouseUp);
|
||||
window.removeEventListener('mouseup', this._handleMouseUp, true);
|
||||
window.removeEventListener('touchend', this._handleMouseUp, true);
|
||||
this.fire('transformend');
|
||||
this.getNode().fire('transformend');
|
||||
}
|
||||
@ -19243,6 +19243,7 @@
|
||||
this.update();
|
||||
},
|
||||
update: function() {
|
||||
console.log('update');
|
||||
var attrs = this._getNodeRect();
|
||||
var width = attrs.width;
|
||||
var height = attrs.height;
|
||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -8,13 +8,13 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name hue
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} hue value between 0 and 359
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name hue
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} hue value between 0 and 359
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(
|
||||
Konva.Node,
|
||||
@ -24,13 +24,13 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name saturation
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.
|
||||
* @name saturation
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(
|
||||
Konva.Node,
|
||||
@ -40,24 +40,24 @@
|
||||
Konva.Factory.afterSetFilter
|
||||
);
|
||||
/**
|
||||
* get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter.
|
||||
* @name value
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} value 0 is no change, -1.0 halves the value, 1.0 doubles, etc..
|
||||
* @returns {Number}
|
||||
*/
|
||||
* get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter.
|
||||
* @name value
|
||||
* @method
|
||||
* @memberof Konva.Node.prototype
|
||||
* @param {Number} value from -1 to 1
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
/**
|
||||
* HSL Filter. Adjusts the hue, saturation and luminance (or lightness)
|
||||
* @function
|
||||
* @memberof Konva.Filters
|
||||
* @param {Object} imageData
|
||||
* @author ippo615
|
||||
* @example
|
||||
* image.filters([Konva.Filters.HSL]);
|
||||
* image.luminance(200);
|
||||
*/
|
||||
* HSL Filter. Adjusts the hue, saturation and luminance (or lightness)
|
||||
* @function
|
||||
* @memberof Konva.Filters
|
||||
* @param {Object} imageData
|
||||
* @author ippo615
|
||||
* @example
|
||||
* image.filters([Konva.Filters.HSL]);
|
||||
* image.luminance(200);
|
||||
*/
|
||||
|
||||
Konva.Filters.HSL = function(imageData) {
|
||||
var data = imageData.data,
|
||||
@ -84,14 +84,14 @@
|
||||
vsw = v * s * Math.sin(h * Math.PI / 180);
|
||||
// (result spot)(source spot)
|
||||
var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw,
|
||||
rg = 0.587 * v - 0.587 * vsu + 0.330 * vsw,
|
||||
rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw,
|
||||
rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
|
||||
var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw,
|
||||
gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw,
|
||||
gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
|
||||
var br = 0.299 * v - 0.300 * vsu + 1.250 * vsw,
|
||||
bg = 0.587 * v - 0.586 * vsu - 1.050 * vsw,
|
||||
bb = 0.114 * v + 0.886 * vsu - 0.200 * vsw;
|
||||
var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw,
|
||||
bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw,
|
||||
bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
|
||||
|
||||
var r, g, b, a;
|
||||
|
||||
|
@ -344,8 +344,8 @@
|
||||
|
||||
window.addEventListener('mousemove', this._handleMouseMove);
|
||||
window.addEventListener('touchmove', this._handleMouseMove);
|
||||
window.addEventListener('mouseup', this._handleMouseUp);
|
||||
window.addEventListener('touchend', this._handleMouseUp);
|
||||
window.addEventListener('mouseup', this._handleMouseUp, true);
|
||||
window.addEventListener('touchend', this._handleMouseUp, true);
|
||||
|
||||
this._transforming = true;
|
||||
|
||||
@ -545,8 +545,8 @@
|
||||
this._transforming = false;
|
||||
window.removeEventListener('mousemove', this._handleMouseMove);
|
||||
window.removeEventListener('touchmove', this._handleMouseMove);
|
||||
window.removeEventListener('mouseup', this._handleMouseUp);
|
||||
window.removeEventListener('touchend', this._handleMouseUp);
|
||||
window.removeEventListener('mouseup', this._handleMouseUp, true);
|
||||
window.removeEventListener('touchend', this._handleMouseUp, true);
|
||||
this.fire('transformend');
|
||||
this.getNode().fire('transformend');
|
||||
}
|
||||
@ -609,6 +609,7 @@
|
||||
this.update();
|
||||
},
|
||||
update: function() {
|
||||
console.log('update');
|
||||
var attrs = this._getNodeRect();
|
||||
var width = attrs.width;
|
||||
var height = attrs.height;
|
||||
|
Loading…
Reference in New Issue
Block a user