DOMPoint.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Geometry/DOMPointReadOnly.h>
  8. namespace Web::Geometry {
  9. // https://drafts.fxtf.org/geometry/#DOMPoint
  10. class DOMPoint final : public DOMPointReadOnly {
  11. public:
  12. using WrapperType = Bindings::DOMPointWrapper;
  13. static NonnullRefPtr<DOMPoint> create_with_global_object(Bindings::WindowObject&, double x = 0, double y = 0, double z = 0, double w = 0)
  14. {
  15. return DOMPoint::create(x, y, z, w);
  16. }
  17. static NonnullRefPtr<DOMPoint> create(double x = 0, double y = 0, double z = 0, double w = 0)
  18. {
  19. return adopt_ref(*new DOMPoint(x, y, z, w));
  20. }
  21. double x() const { return m_x; }
  22. double y() const { return m_y; }
  23. double z() const { return m_z; }
  24. double w() const { return m_w; }
  25. void set_x(double x) { m_x = x; }
  26. void set_y(double y) { m_y = y; }
  27. void set_z(double z) { m_z = z; }
  28. void set_w(double w) { m_w = w; }
  29. private:
  30. DOMPoint(float x, float y, float z, float w)
  31. : DOMPointReadOnly(x, y, z, w)
  32. {
  33. }
  34. };
  35. }