Esempio n. 1
0
        public virtual void SetRelativeSizePositionFromAbsoluteValues(PointD2D absSize, PointD2D absPos)
        {
            var oldSizeX = SizeX;
            var oldSizeY = SizeY;
            var oldPosX  = PositionX;
            var oldPosY  = PositionY;

            if (_parentSize.X == 0)
            {
                throw new InvalidOperationException("ParentSize.X is zero. This would lead to an undefined relative value!");
            }
            if (_parentSize.Y == 0)
            {
                throw new InvalidOperationException("ParentSize.Y is zero. This would lead to an undefined relative value!");
            }

            InternalSetSizeSilent(
                RADouble.NewRel(absSize.X / _parentSize.X),
                RADouble.NewRel(absSize.Y / _parentSize.Y)
                );

            _positionX = RADouble.NewRel(absPos.X / _parentSize.X);
            _positionY = RADouble.NewRel(absPos.Y / _parentSize.Y);

            if (oldSizeX != _sizeX || oldSizeY != _sizeY || oldPosX != _positionX || oldPosY != _positionY)
            {
                EhSelfChanged();
            }
        }
        public override bool Apply(bool disposeController)
        {
            _doc.XPartitioning.Clear();
            _doc.YPartitioning.Clear();

            foreach (var val in _columnCollection)
            {
                if (object.ReferenceEquals(val.Unit, _percentLayerXSizeUnit))
                {
                    _doc.XPartitioning.Add(RADouble.NewRel(val.Value / 100));
                }
                else
                {
                    _doc.XPartitioning.Add(RADouble.NewAbs(val.AsValueIn(AUL.Point.Instance)));
                }
            }

            foreach (var val in _rowCollection)
            {
                if (object.ReferenceEquals(val.Unit, _percentLayerYSizeUnit))
                {
                    _doc.YPartitioning.Add(RADouble.NewRel(val.Value / 100));
                }
                else
                {
                    _doc.YPartitioning.Add(RADouble.NewAbs(val.AsValueIn(AUL.Point.Instance)));
                }
            }

            return(ApplyEnd(true, disposeController));
        }
Esempio n. 3
0
        protected virtual void InternalSetAbsoluteSizeSilent(PointD2D value)
        {
            RADouble sizeX, sizeY;

            if (_sizeX.IsAbsolute)
            {
                sizeX = RADouble.NewAbs(value.X);
            }
            else if (_parentSize.X != 0 && !double.IsNaN(_parentSize.X))
            {
                sizeX = RADouble.NewRel(value.X / _parentSize.X);
            }
            else
            {
                throw new InvalidOperationException("_parentSize.X is undefined or zero");
            }

            if (_sizeY.IsAbsolute)
            {
                sizeY = RADouble.NewAbs(value.Y);
            }
            else if (_parentSize.Y != 0 && !double.IsNaN(_parentSize.Y))
            {
                sizeY = RADouble.NewRel(value.Y / _parentSize.Y);
            }
            else
            {
                throw new InvalidOperationException("_parentSize.Y is undefined or zero");
            }

            InternalSetSizeSilent(sizeX, sizeY);
        }
Esempio n. 4
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);

                if (info.CurrentElementName == "BaseType") // that was included since 2006-06-20
                {
                    info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);
                }
                else
                {
                    info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent); // before 2006-06-20, it was version 0 of the GraphicsObject
                }

                s._text      = info.GetString("Text");
                s._font      = (FontX)info.GetValue("Font", s);
                s._textBrush = (BrushX)info.GetValue("Brush", s);
                if (null != s._textBrush)
                {
                    s._textBrush.ParentObject = s;
                }
                s._background = (IBackgroundStyle)info.GetValue("BackgroundStyle", s);
                if (null != s._background)
                {
                    s._background.ParentObject = s;
                }
                s._lineSpacingFactor = info.GetSingle("LineSpacing");
                var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
                var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);

                s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
                s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);
                return(s);
            }
Esempio n. 5
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);

                info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent);

                // we have changed the meaning of rotation in the meantime, This is not handled in GetBaseValueEmbedded,
                // since the former versions did not store the version number of embedded bases
                //s._rotation = -s._rotation;

                s._text      = info.GetString("Text");
                s._font      = (FontX)info.GetValue("Font", s);
                s._textBrush = (BrushX)info.GetValue("Brush", s);
                if (null != s._textBrush)
                {
                    s._textBrush.ParentObject = s;
                }
                s.BackgroundStyleOld = (BackgroundStyle)info.GetValue("BackgroundStyle", s);
                s._lineSpacingFactor = info.GetSingle("LineSpacing");
                info.GetSingle("ShadowLength");
                var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
                var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);

                s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
                s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);

                return(s);
            }
Esempio n. 6
0
 public ItemLocationDirect()
 {
     _localAnchorX  = RADouble.NewRel(0);
     _localAnchorY  = RADouble.NewRel(0);
     _parentAnchorX = RADouble.NewRel(0);
     _parentAnchorY = RADouble.NewRel(0);
     _scaleX        = 1;
     _scaleY        = 1;
 }
Esempio n. 7
0
 private void EhRadioChecked(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < 3; ++i)
     {
         for (int j = 0; j < 3; ++j)
         {
             if (object.Equals(sender, _buttons[j, i]))
             {
                 _pivots[j] = RADouble.NewRel(0.5 * i);
             }
         }
     }
 }
Esempio n. 8
0
 protected virtual void InternalSetAbsoluteSizeYSilent(double value)
 {
     if (_sizeY.IsAbsolute)
     {
         InternalSetSizeYSilent(RADouble.NewAbs(value));
     }
     else if (_parentSize.Y != 0 && !double.IsNaN(_parentSize.Y))
     {
         InternalSetSizeYSilent(RADouble.NewRel(value / _parentSize.Y));
     }
     else
     {
         throw new InvalidOperationException("_parentSize.Y is undefined or zero");
     }
 }
Esempio n. 9
0
        private void EhNumericPivotYChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var quant = _guiPivotY.SelectedQuantity;

            if (object.ReferenceEquals(quant.Unit, _percentLayerYSizeUnit))
            {
                _pivotY = RADouble.NewRel(quant.Value / 100);
            }
            else
            {
                _pivotY = RADouble.NewAbs(quant.AsValueIn(AUL.Point.Instance));
            }

            SetVisibilityOfSwitchButton();
        }
 /// <summary>
 /// Internal set absolute size y silent. This function is allowed to set <see cref="ItemLocationDirect._sizeY"/> directly. This is the reason why it is declared as private.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <exception cref="System.InvalidOperationException">_parentSize.Y is undefined or zero</exception>
 private void InternalSetAbsoluteSizeYSilentHere(double value)
 {
     if (_sizeY.IsAbsolute)
     {
         _sizeY = RADouble.NewAbs(value);
     }
     else if (_parentSize.Y != 0 && !double.IsNaN(_parentSize.Y))
     {
         _sizeY = RADouble.NewRel(value / _parentSize.Y);
     }
     else
     {
         throw new InvalidOperationException("_parentSize.Y is undefined or zero");
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Creates a new layer with bottom x axis and left y axis, which is not linked.
        /// </summary>
        public static void CreateNewLayerNormalBottomXLeftY(this GraphDocument doc)
        {
            var context  = doc.GetPropertyHierarchy();
            var location = new ItemLocationDirect
            {
                PositionX = RADouble.NewRel(HostLayer.DefaultChildLayerRelativePosition.X),
                PositionY = RADouble.NewRel(HostLayer.DefaultChildLayerRelativePosition.Y),
                SizeX     = RADouble.NewRel(HostLayer.DefaultChildLayerRelativeSize.X),
                SizeY     = RADouble.NewRel(HostLayer.DefaultChildLayerRelativeSize.Y)
            };

            var newlayer = new XYPlotLayer(doc.RootLayer, location);

            doc.RootLayer.Layers.Add(newlayer);
            newlayer.CreateDefaultAxes(context);
        }
Esempio n. 12
0
        private void InternalSetAbsolutePivotPositionYSilent(double value)
        {
            var mySizeY = _sizeY.GetValueRelativeTo(_parentSize.Y);

            if (_positionY.IsAbsolute)
            {
                _positionY = RADouble.NewAbs(value - _parentAnchorY.GetValueRelativeTo(_parentSize.Y));
            }
            else if (0 != _parentSize.Y && _parentSize.Y.IsFinite())
            {
                _positionY = RADouble.NewRel((value - _parentAnchorY.GetValueRelativeTo(_parentSize.Y)) / _parentSize.Y);
            }
            else
            {
                throw new InvalidOperationException("_parentSize.Y is undefined or zero");
            }
        }
Esempio n. 13
0
        private void InternalSetAbsolutePositionXSilent(double value)
        {
            var mySizeX = _sizeX.GetValueRelativeTo(_parentSize.X);

            if (_positionX.IsAbsolute)
            {
                _positionX = RADouble.NewAbs(value - _parentAnchorX.GetValueRelativeTo(_parentSize.X) + _localAnchorX.GetValueRelativeTo(mySizeX));
            }
            else if (0 != _parentSize.X && _parentSize.X.IsFinite())
            {
                _positionX = RADouble.NewRel((value - _parentAnchorX.GetValueRelativeTo(_parentSize.X) + _localAnchorX.GetValueRelativeTo(mySizeX)) / _parentSize.X);
            }
            else
            {
                throw new InvalidOperationException("_parentSize.X is undefined or zero");
            }
        }
Esempio n. 14
0
        public static void ArrangeGrid(this ArrangeLayersDocument arrangement, GridPartitioning grid)
        {
            grid.XPartitioning.Clear();
            grid.YPartitioning.Clear();

            double columnSize = Math.Max(0, 1 - arrangement.LeftMargin - arrangement.RightMargin - (arrangement.NumberOfColumns - 1) * arrangement.ColumnSpacing);
            double rowSize    = Math.Max(0, 1 - arrangement.TopMargin - arrangement.BottomMargin - (arrangement.NumberOfRows - 1) * arrangement.RowSpacing);

            if (arrangement.NumberOfColumns > 0)
            {
                grid.XPartitioning.Add(RADouble.NewRel(arrangement.LeftMargin));
                for (int i = arrangement.NumberOfColumns - 1; i >= 0; --i)
                {
                    grid.XPartitioning.Add(RADouble.NewRel(columnSize / arrangement.NumberOfColumns));
                    if (i != 0)
                    {
                        grid.XPartitioning.Add(RADouble.NewRel(arrangement.ColumnSpacing));
                    }
                }
                grid.XPartitioning.Add(RADouble.NewRel(arrangement.RightMargin));
            }
            else
            {
                grid.XPartitioning.Add(RADouble.NewRel(1));
            }

            if (arrangement.NumberOfRows > 0)
            {
                grid.YPartitioning.Add(RADouble.NewRel(arrangement.TopMargin));
                for (int i = arrangement.NumberOfRows - 1; i >= 0; --i)
                {
                    grid.YPartitioning.Add(RADouble.NewRel(rowSize / arrangement.NumberOfRows));
                    if (i != 0)
                    {
                        grid.YPartitioning.Add(RADouble.NewRel(arrangement.RowSpacing));
                    }
                }
                grid.YPartitioning.Add(RADouble.NewRel(arrangement.BottomMargin));
            }
            else
            {
                grid.YPartitioning.Add(RADouble.NewRel(1));
            }
        }
        private void EhSizeYChanged()
        {
            var actn = SizeYChanged;

            if (null != actn)
            {
                RADouble result;
                var      ySize = _view.YSize;

                if (object.ReferenceEquals(ySize.Unit, _percentLayerYSizeUnit))
                {
                    result = RADouble.NewRel(ySize.Value / 100);
                }
                else
                {
                    result = RADouble.NewAbs(ySize.AsValueIn(AUL.Point.Instance));
                }
                actn(result);
            }
        }
        public override bool Apply(bool disposeController)
        {
            try
            {
                _doc.Rotation = _view.Rotation;
                _doc.ShearX   = _view.Shear;
                _doc.ScaleX   = _view.ScaleX;
                _doc.ScaleY   = _view.ScaleY;

                if (!_doc.IsAutoSized)
                {
                    var xSize = _view.XSize;
                    var ySize = _view.YSize;

                    if (object.ReferenceEquals(xSize.Unit, _percentLayerXSizeUnit))
                    {
                        _doc.SizeX = RADouble.NewRel(xSize.Value / 100);
                    }
                    else
                    {
                        _doc.SizeX = RADouble.NewAbs(xSize.AsValueIn(AUL.Point.Instance));
                    }

                    if (object.ReferenceEquals(ySize.Unit, _percentLayerYSizeUnit))
                    {
                        _doc.SizeY = RADouble.NewRel(ySize.Value / 100);
                    }
                    else
                    {
                        _doc.SizeY = RADouble.NewAbs(ySize.AsValueIn(AUL.Point.Instance));
                    }
                }

                var xPos = _view.XPosition;
                var yPos = _view.YPosition;

                if (object.ReferenceEquals(xPos.Unit, _percentLayerXSizeUnit))
                {
                    _doc.PositionX = RADouble.NewRel(xPos.Value / 100);
                }
                else
                {
                    _doc.PositionX = RADouble.NewAbs(xPos.AsValueIn(AUL.Point.Instance));
                }

                if (object.ReferenceEquals(yPos.Unit, _percentLayerYSizeUnit))
                {
                    _doc.PositionY = RADouble.NewRel(yPos.Value / 100);
                }
                else
                {
                    _doc.PositionY = RADouble.NewAbs(yPos.AsValueIn(AUL.Point.Instance));
                }

                _doc.LocalAnchorX = _view.PivotX;
                _doc.LocalAnchorY = _view.PivotY;

                _doc.ParentAnchorX = _view.ReferenceX;
                _doc.ParentAnchorY = _view.ReferenceY;
            }
            catch (Exception)
            {
                return(false); // indicate that something failed
            }

            return(ApplyEnd(true, disposeController));
        }
Esempio n. 17
0
        public override bool Apply(bool disposeController)
        {
            try
            {
                _doc.RotationX = _view.RotationX;
                _doc.RotationY = _view.RotationY;
                _doc.RotationZ = _view.RotationZ;
                _doc.ShearX    = _view.ShearX;
                _doc.ShearY    = _view.ShearY;
                _doc.ShearZ    = _view.ShearZ;
                _doc.ScaleX    = _view.ScaleX;
                _doc.ScaleY    = _view.ScaleY;
                _doc.ScaleZ    = _view.ScaleZ;

                if (!_doc.IsAutoSized)
                {
                    var xSize = _view.XSize;
                    var ySize = _view.YSize;
                    var zSize = _view.ZSize;

                    if (object.ReferenceEquals(xSize.Unit, _percentLayerXSizeUnit))
                    {
                        _doc.SizeX = RADouble.NewRel(xSize.Value / 100);
                    }
                    else
                    {
                        _doc.SizeX = RADouble.NewAbs(xSize.AsValueIn(AUL.Point.Instance));
                    }

                    if (object.ReferenceEquals(ySize.Unit, _percentLayerYSizeUnit))
                    {
                        _doc.SizeY = RADouble.NewRel(ySize.Value / 100);
                    }
                    else
                    {
                        _doc.SizeY = RADouble.NewAbs(ySize.AsValueIn(AUL.Point.Instance));
                    }

                    if (object.ReferenceEquals(zSize.Unit, _percentLayerZSizeUnit))
                    {
                        _doc.SizeZ = RADouble.NewRel(zSize.Value / 100);
                    }
                    else
                    {
                        _doc.SizeZ = RADouble.NewAbs(zSize.AsValueIn(AUL.Point.Instance));
                    }
                }

                var xPos = _view.XPosition;
                var yPos = _view.YPosition;
                var zPos = _view.ZPosition;

                if (object.ReferenceEquals(xPos.Unit, _percentLayerXSizeUnit))
                {
                    _doc.PositionX = RADouble.NewRel(xPos.Value / 100);
                }
                else
                {
                    _doc.PositionX = RADouble.NewAbs(xPos.AsValueIn(AUL.Point.Instance));
                }

                if (object.ReferenceEquals(yPos.Unit, _percentLayerYSizeUnit))
                {
                    _doc.PositionY = RADouble.NewRel(yPos.Value / 100);
                }
                else
                {
                    _doc.PositionY = RADouble.NewAbs(yPos.AsValueIn(AUL.Point.Instance));
                }

                if (object.ReferenceEquals(zPos.Unit, _percentLayerZSizeUnit))
                {
                    _doc.PositionZ = RADouble.NewRel(zPos.Value / 100);
                }
                else
                {
                    _doc.PositionZ = RADouble.NewAbs(zPos.AsValueIn(AUL.Point.Instance));
                }

                _doc.LocalAnchorX = _view.PivotX;
                _doc.LocalAnchorY = _view.PivotY;
                _doc.LocalAnchorZ = _view.PivotZ;

                _doc.ParentAnchorX = _view.ReferenceX;
                _doc.ParentAnchorY = _view.ReferenceY;
                _doc.ParentAnchorZ = _view.ReferenceZ;
            }
            catch (Exception ex)
            {
                Current.Gui.ErrorMessageBox(ex.Message, "Error applying ItemLocationDirect");
                return(false); // indicate that something failed
            }

            return(ApplyEnd(true, disposeController));
        }
Esempio n. 18
0
 public void ChangeParentAnchorToLeftTopButKeepPosition()
 {
     ChangeParentAnchorButKeepPosition(RADouble.NewRel(0), RADouble.NewRel(0));
 }
Esempio n. 19
0
        public DensityImageLegend(DensityImagePlotItem plotItem, Main.IDocumentNode futureParentObject, PointD2D initialLocation, PointD2D graphicSize, Main.Properties.IReadOnlyPropertyBag context)
            : base(new ItemLocationDirect())
        {
            if (null == plotItem)
            {
                throw new ArgumentNullException("plotItem");
            }
            if (null == futureParentObject)
            {
                throw new ArgumentNullException("futureParentObject");
            }

            ParentObject = futureParentObject;
            PlotItem     = plotItem;
            if (null == _plotItemProxy.DocumentPath)
            {
                throw new ArgumentException("No path could be found between plotItem and futureParentObject. This is an indication that one of the objects is not rooted.");
            }

            SetSize(graphicSize.X, graphicSize.Y, Main.EventFiring.Suppressed);
            SetPosition(initialLocation, Main.EventFiring.Suppressed);

            // _orientationIsVertical = true;
            // _scaleIsReversed = false;

            var cachedScale      = (NumericalScale)PlotItem.Style.Scale.Clone();
            var scaleTickSpacing = Altaxo.Graph.Scales.Scale.CreateDefaultTicks(cachedScale.GetType());

            _cachedArea = new DensityLegendArea(Size, true, false, cachedScale, scaleTickSpacing);
            //_cachedArea.ParentObject = this; // --> moved to the end of this function

            _axisStyles = new AxisStyleCollection();
            _axisStyles.UpdateCoordinateSystem(_cachedArea.CoordinateSystem);
            // _axisStyles.ParentObject = this; --> see below

            var sx0 = new AxisStyle(CSLineID.X0, true, true, false, "Z values", context);

            sx0.AxisLineStyle.FirstDownMajorTicks = true;
            sx0.AxisLineStyle.FirstUpMajorTicks   = false;
            sx0.AxisLineStyle.FirstDownMinorTicks = true;
            sx0.AxisLineStyle.FirstUpMinorTicks   = false;

            var sx1 = new AxisStyle(CSLineID.X1, true, false, false, null, context);

            sx1.AxisLineStyle.FirstDownMajorTicks = false;
            sx1.AxisLineStyle.FirstUpMajorTicks   = false;
            sx1.AxisLineStyle.FirstDownMinorTicks = false;
            sx1.AxisLineStyle.FirstUpMinorTicks   = false;

            var sy0 = new AxisStyle(CSLineID.Y0, true, false, false, "Color map", context);
            var sy1 = new AxisStyle(CSLineID.Y1, true, false, false, null, context);

            _axisStyles.Add(sx0);
            _axisStyles.Add(sx1);
            _axisStyles.Add(sy0);
            _axisStyles.Add(sy1);

            sx0.Title.Rotation = 90;
            sx0.Title.Location.ParentAnchorX = RADouble.NewRel(0);   // Left
            sx0.Title.Location.ParentAnchorY = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sx0.Title.X = -Width / 3;
            sx0.Title.Y = 0;

            sy0.Title.Location.ParentAnchorX = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.ParentAnchorY = RADouble.NewRel(0);   // Top
            sy0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sy0.Title.X = 0;
            sy0.Title.Y = sy0.Title.Height / 2;

            // set the parent objects
            _axisStyles.ParentObject = this;
            _cachedArea.ParentObject = this;
            UpdateTransformationMatrix();
        }
Esempio n. 20
0
            public IItemLocation ConvertToCurrentLocationVersion(PointD2D cachedLayerSize, PointD2D cachedLayerPosition)
            {
                var newLoc = new ItemLocationDirect();

                switch (_layerWidthType)
                {
                case XYPlotLayerSizeType.AbsoluteValue:
                    newLoc.SizeX = RADouble.NewAbs(_layerWidth);
                    break;

                case XYPlotLayerSizeType.RelativeToGraphDocument:
                    newLoc.SizeX = RADouble.NewRel(_layerWidth);
                    break;

                default:
                    newLoc.SizeX = RADouble.NewAbs(cachedLayerSize.X);
                    break;
                }

                switch (_layerHeightType)
                {
                case XYPlotLayerSizeType.AbsoluteValue:
                    newLoc.SizeY = RADouble.NewAbs(_layerHeight);
                    break;

                case XYPlotLayerSizeType.RelativeToGraphDocument:
                    newLoc.SizeY = RADouble.NewRel(_layerHeight);
                    break;

                default:
                    newLoc.SizeY = RADouble.NewAbs(cachedLayerSize.Y);
                    break;
                }

                switch (_layerXPositionType)
                {
                case XYPlotLayerPositionType.AbsoluteValue:
                    newLoc.PositionX = RADouble.NewAbs(_layerXPosition);
                    break;

                case XYPlotLayerPositionType.RelativeToGraphDocument:
                    newLoc.PositionX = RADouble.NewRel(_layerXPosition);
                    break;

                default:
                    newLoc.PositionX = RADouble.NewAbs(cachedLayerPosition.X);
                    break;
                }

                switch (_layerYPositionType)
                {
                case XYPlotLayerPositionType.AbsoluteValue:
                    newLoc.PositionY = RADouble.NewAbs(_layerYPosition);
                    break;

                case XYPlotLayerPositionType.RelativeToGraphDocument:
                    newLoc.PositionY = RADouble.NewRel(_layerYPosition);
                    break;

                default:
                    newLoc.PositionY = RADouble.NewAbs(cachedLayerPosition.Y);
                    break;
                }

                newLoc.Rotation = _layerAngle;
                newLoc.ScaleX   = newLoc.ScaleY = _layerScale;

                return(newLoc);
            }