modify fromElement functions for all shapes, to support new viewports ,issue #1137