Prevention if resize of shape in a particular diection

How can I prevent a shape from being resized in a particular direction?

Thanks and Regards

Implement a resize rule similar to the one in bpmn-js BpmnRules.js#L70.

Checkout the example for adding custom rules to learn more about rules.