Skip to content

Commit f851d80

Browse files
committed
Prevents modifications to managed paths
1 parent 31e5816 commit f851d80

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

DynamicLightRecorder/DynamicLightRecorder.js

+17
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,22 @@ var DynamicLightRecorder = DynamicLightRecorder || (function() {
408408
var controlInfo = this.getControlInfoObject(token).onDelete();
409409
},
410410

411+
handlePathChange: function(path, previous) {
412+
if (previous.controlledby && previous.layer === 'walls') {
413+
var graphic = getObj('graphic', previous.controlledby);
414+
if (graphic && graphic.get('name') === 'DynamicLightRecorder') {
415+
path.set('top', previous.top);
416+
path.set('left', previous.left);
417+
path.set('width', previous.width);
418+
path.set('height', previous.height);
419+
path.set('scaleX', previous.scaleX);
420+
path.set('scaleY', previous.scaleY);
421+
path.set('rotation', previous.rotation);
422+
path.set('controlledby', previous.controlledby);
423+
}
424+
}
425+
},
426+
411427

412428

413429
///////////////////////////////////////////////
@@ -1661,6 +1677,7 @@ var DynamicLightRecorder = DynamicLightRecorder || (function() {
16611677
registerEventHandlers = function() {
16621678
on('chat:message', module.handleInput.bind(module));
16631679
on('change:token', module.handleTokenChange.bind(module));
1680+
on('change:path', module.handlePathChange.bind(module));
16641681
on('add:token', module.handleNewToken.bind(module));
16651682
on('destroy:token', module.handleDeleteToken.bind(module));
16661683
};

0 commit comments

Comments
 (0)