handle_target_anchor.rml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <rml>
  2. <head>
  3. <title>Handle anchor positioning</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <meta name="Description" content="Handles should respect the target element's anchoring to its parent, determined by its top/right/bottom/left properties." />
  6. <meta name="Assert" content="The anchoring should still hold after moving and resizing the target." />
  7. <meta name="Assert" content="The handles should constrain the movement and sizing such that the target element is located within the edge margin of its containing block." />
  8. <style>
  9. handle[move_target] {
  10. top: 0;
  11. right: 0;
  12. left: 0;
  13. bottom: auto;
  14. height: 20px;
  15. width: auto;
  16. cursor: move;
  17. }
  18. body, div {
  19. border: 5dp #fff;
  20. padding-top: 2em;
  21. }
  22. body {
  23. text-align: center;
  24. z-index: 100;
  25. box-sizing: border-box;
  26. border: 5dp #222;
  27. width: auto;
  28. height: auto;
  29. top: 100dp;
  30. bottom: 100dp;
  31. left: 100dp;
  32. right: 580dp;
  33. }
  34. div {
  35. position: absolute;
  36. z-index: 1;
  37. background: #eee;
  38. min-width: 100dp;
  39. min-height: 50dp;
  40. border-width: 0;
  41. margin: 30dp 20dp;
  42. }
  43. .top_left {
  44. top: 25px;
  45. left: 25px;
  46. width: 180dp;
  47. height: 100dp;
  48. }
  49. .top_right_bottom_left {
  50. top: 200px;
  51. left: 250px;
  52. bottom: 200px;
  53. right: 250px;
  54. }
  55. .bottom_right {
  56. bottom: 25px;
  57. right: 25px;
  58. width: 180dp;
  59. height: 100dp;
  60. }
  61. </style>
  62. </head>
  63. <body>
  64. <p>Document</p>
  65. <div class="top_left">
  66. <p>Anchored top-left</p>
  67. <p>Edge margin: -50%</p>
  68. <handle move_target="#parent" edge_margin="-50%"/>
  69. <handle size_target="#parent" edge_margin="-50%"/>
  70. </div>
  71. <div class="top_right_bottom_left">
  72. <p>Anchored all sides</p>
  73. <p>Edge margin: 50dp</p>
  74. <handle move_target="#parent" edge_margin="50dp"/>
  75. <handle size_target="#parent" edge_margin="50dp"/>
  76. </div>
  77. <div class="bottom_right">
  78. <p>Anchored bottom-right</p>
  79. <p>Edge margin: 0px</p>
  80. <handle move_target="#parent"/>
  81. <handle size_target="#parent"/>
  82. </div>
  83. <handle move_target="#parent"/>
  84. <handle size_target="#parent"/>
  85. </body>
  86. </rml>