scripts/token-attacher.js
//Attached elements are only allowed to be moved by token attacher functions.
Attached elements are only allowed to be moved by token attacher functions.
Attached elements are only allowed to be moved by token attacher functions .
static isAllowedToMove(document, change, options, userId){
			if(	(		change.hasOwnProperty("x")
					||	change.hasOwnProperty("y")
					||	change.hasOwnProperty("c")
					||	change.hasOwnProperty("rotation")
					||	Object.keys(change).length == 0)
				&&	getProperty(document, `data.flags.${moduleName}.needsPostProcessing`) 
				&& !getProperty(options, `${moduleName}`)) {				
				ui.notifications.error(game.i18n.format(localizedStrings.error.PostProcessingNotFinished));
				return false;
			}
			if(!(	change.hasOwnProperty("x")
				||	change.hasOwnProperty("y")
				||	change.hasOwnProperty("c")
				||	change.hasOwnProperty("rotation"))){
				return true;
			}
			let animate = getProperty(document, `data.flags.${moduleName}.animate`) ?? true;
			if(!animate) setProperty(options, `animate`, animate);
			let offset = getProperty(document, `data.flags.${moduleName}.offset`) || {};
			if(Object.keys(offset).length === 0) return true;
			if(getProperty(options, `${moduleName}.update`)) return true;
			let objParent = getProperty(document, `data.flags.${moduleName}.parent`) || "";
			if(TokenAttacher.isAttachmentUIOpen() && TokenAttacher.isCurrentAttachUITarget(objParent)) return true;
			if(game.user.isGM){
				let quickEdit = getProperty(window, 'tokenAttacher.quickEdit');
				if(quickEdit && canvas.scene.data._id === quickEdit.scene) {
					setProperty(options, `${moduleName}.QuickEdit`, true);
					return true;
				}
			}
			return false;
		}
static isAllowedToMove ( document , change , options , userId ) { if ( ( change . hasOwnProperty ( "x" ) || change . hasOwnProperty ( "y" ) || change . hasOwnProperty ( "c" ) || change . hasOwnProperty ( "rotation" ) || Object . keys ( change ) . length == 0 ) && getProperty ( document , ` ${ moduleName } ` ) && ! getProperty ( options , ` ${ moduleName } ` ) ) { ui . notifications . error ( game . i18n . format ( localizedStrings . error . PostProcessingNotFinished ) ) ; return false ; } if ( ! ( change . hasOwnProperty ( "x" ) || change . hasOwnProperty ( "y" ) || change . hasOwnProperty ( "c" ) || change . hasOwnProperty ( "rotation" ) ) ) { return true ; } let animate = getProperty ( document , ` ${ moduleName } ` ) ?? true ; if ( ! animate ) setProperty ( options , ` ` , animate ) ; let offset = getProperty ( document , ` ${ moduleName } ` ) || { } ; if ( Object . keys ( offset ) . length === 0 ) return true ; if ( getProperty ( options , ` ${ moduleName } ` ) ) return true ; let objParent = getProperty ( document , ` ${ moduleName } ` ) || "" ; if ( TokenAttacher . isAttachmentUIOpen ( ) && TokenAttacher . isCurrentAttachUITarget ( objParent ) ) return true ; if ( game . user . isGM ) { let quickEdit = getProperty ( window , 'tokenAttacher.quickEdit' ) ; if ( quickEdit && canvas . scene . data . _id === quickEdit . scene ) { setProperty ( options , ` ${ moduleName } ` , true ) ; return true ; } } return false ; }
Attached elements are only allowed to be moved by token attacher functions.
Attached elements are only allowed to be moved by token attacher functions .