mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-10 06:44:44 +00:00
Make isSameColor cave-insensitive. Closes #1272
This commit is contained in:
parent
a48ed5b31b
commit
d6a73aa7f5
6 changed files with 16 additions and 10 deletions
4
dist/fabric.js
vendored
4
dist/fabric.js
vendored
|
|
@ -15233,9 +15233,9 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @return {Boolean} true if all paths are of the same color (`fill`)
|
||||
*/
|
||||
isSameColor: function() {
|
||||
var firstPathFill = this.getObjects()[0].get('fill');
|
||||
var firstPathFill = (this.getObjects()[0].get('fill') || '').toLowerCase();
|
||||
return this.getObjects().every(function(path) {
|
||||
return path.get('fill') === firstPathFill;
|
||||
return (path.get('fill') || '').toLowerCase() === firstPathFill;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
6
dist/fabric.min.js
vendored
6
dist/fabric.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/fabric.min.js.gz
vendored
BIN
dist/fabric.min.js.gz
vendored
Binary file not shown.
4
dist/fabric.require.js
vendored
4
dist/fabric.require.js
vendored
|
|
@ -15233,9 +15233,9 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @return {Boolean} true if all paths are of the same color (`fill`)
|
||||
*/
|
||||
isSameColor: function() {
|
||||
var firstPathFill = this.getObjects()[0].get('fill');
|
||||
var firstPathFill = (this.getObjects()[0].get('fill') || '').toLowerCase();
|
||||
return this.getObjects().every(function(path) {
|
||||
return path.get('fill') === firstPathFill;
|
||||
return (path.get('fill') || '').toLowerCase() === firstPathFill;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -182,9 +182,9 @@
|
|||
* @return {Boolean} true if all paths are of the same color (`fill`)
|
||||
*/
|
||||
isSameColor: function() {
|
||||
var firstPathFill = this.getObjects()[0].get('fill');
|
||||
var firstPathFill = (this.getObjects()[0].get('fill') || '').toLowerCase();
|
||||
return this.getObjects().every(function(path) {
|
||||
return path.get('fill') === firstPathFill;
|
||||
return (path.get('fill') || '').toLowerCase() === firstPathFill;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
function getPathGroupObject(callback) {
|
||||
getPathObjects(function(objects) {
|
||||
callback(new fabric.PathGroup(objects));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
QUnit.module('fabric.PathGroup');
|
||||
|
|
@ -178,6 +178,12 @@
|
|||
|
||||
pathGroup.getObjects()[0].set('fill', 'black');
|
||||
equal(pathGroup.isSameColor(), false);
|
||||
|
||||
// case
|
||||
pathGroup.getObjects()[0].set('fill', '#ff5555');
|
||||
pathGroup.getObjects()[1].set('fill', '#FF5555');
|
||||
equal(pathGroup.isSameColor(), true);
|
||||
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue