mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
filters fixes
This commit is contained in:
parent
0eec587cd6
commit
f2f675cd6b
@ -67,6 +67,8 @@
|
||||
dirY = 0;
|
||||
dirX = -1;
|
||||
break;
|
||||
default:
|
||||
Konva.Util.error('Unknwo emboss direction: ' + direction);
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -29,6 +29,11 @@
|
||||
xBin, yBin, pixelsInBin;
|
||||
imageData = imageData.data;
|
||||
|
||||
if (pixelSize <= 0) {
|
||||
Konva.Util.error('pixelSize value can not be <= 0');
|
||||
return;
|
||||
}
|
||||
|
||||
for (xBin = 0; xBin < nBinsX; xBin += 1) {
|
||||
for (yBin = 0; yBin < nBinsY; yBin += 1) {
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* @example
|
||||
* node.cache();
|
||||
* node.filters([Konva.Filters.Posterize]);
|
||||
* node.levels(0.8);
|
||||
* node.levels(0.8); // between 0 and 1
|
||||
*/
|
||||
|
||||
Konva.Filters.Posterize = function (imageData) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
suite('Text', function(){
|
||||
suite.only('Text', function(){
|
||||
// ======================================================
|
||||
test('text with empty config is allowed', function() {
|
||||
var stage = addStage();
|
||||
@ -206,7 +206,7 @@ suite('Text', function(){
|
||||
y: 10,
|
||||
text: 'HEADING\n\nAll the world\'s a stage, merely players. They have their exits and their entrances; And one man in his time plays many parts.',
|
||||
//text: 'HEADING\n\nThis is a really cool paragraph. \n And this is a footer.',
|
||||
fontSize: 24,
|
||||
fontSize: 14,
|
||||
fontFamily: 'Calibri',
|
||||
fontStyle: 'normal',
|
||||
fill: '#555',
|
||||
@ -214,32 +214,20 @@ suite('Text', function(){
|
||||
width: 380,
|
||||
//width: 200,
|
||||
padding: 10,
|
||||
lineHeight: 2,
|
||||
align: 'center',
|
||||
draggable: true,
|
||||
wrap: 'WORD'
|
||||
});
|
||||
|
||||
rect.height(text.getHeight());
|
||||
// center text box
|
||||
//text.setOffset(text.getBoxWidth() / 2, text.getBoxHeight() / 2);
|
||||
|
||||
layer.add(rect).add(text);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(text.getLineHeight(), 1);
|
||||
|
||||
/*
|
||||
text.transitionTo({
|
||||
width: 50,
|
||||
duration: 20
|
||||
});
|
||||
|
||||
rect.transitionTo({
|
||||
width: 50,
|
||||
duration: 20
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
assert.equal(text.getLineHeight(), 20);
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
@ -443,5 +431,4 @@ suite('Text', function(){
|
||||
assert.equal(data[3], 255, '255 alpha - fully visible');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user