mirror of
https://github.com/konvajs/konva.git
synced 2025-12-29 02:03:29 +08:00
16
konva.js
16
konva.js
@@ -3,7 +3,7 @@
|
||||
* Konva JavaScript Framework v0.11.1
|
||||
* http://konvajs.github.io/
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Fri Feb 05 2016
|
||||
* Date: Fri Feb 26 2016
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva)
|
||||
@@ -8659,8 +8659,18 @@
|
||||
*/
|
||||
setContainer: function (container) {
|
||||
if (typeof container === STRING) {
|
||||
var id = container;
|
||||
container = Konva.document.getElementById(container);
|
||||
if (container.charAt(0) === '.') {
|
||||
var className = container.slice(1);
|
||||
container = Konva.document.getElementsByClassName(className)[0];
|
||||
} else {
|
||||
var id;
|
||||
if (container.charAt(0) !== '#') {
|
||||
id = container;
|
||||
} else {
|
||||
id = container.slice(1);
|
||||
}
|
||||
container = Konva.document.getElementById(id);
|
||||
}
|
||||
if (!container) {
|
||||
throw 'Can not find container in document with id ' + id;
|
||||
}
|
||||
|
||||
14
src/Stage.js
14
src/Stage.js
@@ -97,8 +97,18 @@
|
||||
*/
|
||||
setContainer: function (container) {
|
||||
if (typeof container === STRING) {
|
||||
var id = container;
|
||||
container = Konva.document.getElementById(container);
|
||||
if (container.charAt(0) === '.') {
|
||||
var className = container.slice(1);
|
||||
container = Konva.document.getElementsByClassName(className)[0];
|
||||
} else {
|
||||
var id;
|
||||
if (container.charAt(0) !== '#') {
|
||||
id = container;
|
||||
} else {
|
||||
id = container.slice(1);
|
||||
}
|
||||
container = Konva.document.getElementById(id);
|
||||
}
|
||||
if (!container) {
|
||||
throw 'Can not find container in document with id ' + id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user