mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
Merge branch 'master' of github.com:konvajs/konva
This commit is contained in:
commit
c0a3057adb
18
konva.js
18
konva.js
@ -8654,10 +8654,20 @@
|
||||
* @memberof Konva.Stage.prototype
|
||||
* @param {DomElement} container can pass in a dom element or id string
|
||||
*/
|
||||
setContainer: function(container) {
|
||||
if( typeof container === STRING) {
|
||||
var id = container;
|
||||
container = Konva.document.getElementById(container);
|
||||
setContainer: function (container) {
|
||||
if (typeof container === STRING) {
|
||||
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;
|
||||
}
|
||||
|
6
konva.min.js
vendored
6
konva.min.js
vendored
File diff suppressed because one or more lines are too long
18
src/Stage.js
18
src/Stage.js
@ -95,10 +95,20 @@
|
||||
* @memberof Konva.Stage.prototype
|
||||
* @param {DomElement} container can pass in a dom element or id string
|
||||
*/
|
||||
setContainer: function(container) {
|
||||
if( typeof container === STRING) {
|
||||
var id = container;
|
||||
container = Konva.document.getElementById(container);
|
||||
setContainer: function (container) {
|
||||
if (typeof container === STRING) {
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user