Dev #11

Merged
w-vandal merged 23 commits from dev into main 2026-09-04 19:13:42 +00:00
Showing only changes of commit 6b4846a646 - Show all commits
+23 -4
View File
@@ -96,9 +96,22 @@ function onSceneObjectMouseDown(e, id) {
// à sa valeur d'origine à la fin.
var previousZIndex = el.style.zIndex;
// Bug corrigé ("toujours bloqué", confirmé lié à l'introduction du fond/
// caméra, voir add_scene_object.py) : un "fond" est posé à sa taille
// RÉELLE (souvent bien plus grande que la scène, ex. 1920px pour une
// scène de 960px — exprès, pour que la caméra puisse le suivre en
// défilant) — Math.max(0, Math.min(SCENE_WIDTH - width, ...)) suppose
// SCENE_WIDTH - width POSITIF (objet plus petit que la scène) : pour un
// objet plus GRAND, cette différence est négative, et Math.max(0, ...)
// ramenait alors TOUJOURS la position à 0 quel que soit le glisser — un
// fond (ou tout autre objet plus grand que la scène) restait donc figé
// à (0,0), impossible à repositionner. min/max sont maintenant calculés
// dans le bon ordre quel que soit lequel des deux est le plus grand.
function applyDelta(dx, dy) {
curLeft = Math.max(0, Math.min(SCENE_WIDTH - width, curLeft + dx));
curTop = Math.max(0, Math.min(SCENE_HEIGHT - height, curTop + dy));
var minLeft = Math.min(0, SCENE_WIDTH - width), maxLeft = Math.max(0, SCENE_WIDTH - width);
var minTop = Math.min(0, SCENE_HEIGHT - height), maxTop = Math.max(0, SCENE_HEIGHT - height);
curLeft = Math.max(minLeft, Math.min(maxLeft, curLeft + dx));
curTop = Math.max(minTop, Math.min(maxTop, curTop + dy));
el.style.left = curLeft + 'px';
el.style.top = curTop + 'px';
}
@@ -143,9 +156,15 @@ function onSceneObjectResizeMouseDown(e, id) {
var previousZIndex = el.style.zIndex;
el.style.zIndex = 9999;
// Pas de plafond à "SCENE_WIDTH - left" ici (bug corrigé) : un objet
// (typiquement un "fond", voir add_scene_object.py) doit pouvoir être
// redimensionné plus GRAND que la scène elle-même — c'est précisément
// le principe de la caméra qui suit le personnage sur un monde plus
// grand que le viewport. Seul un minimum (8px, jamais un objet
// invisible) reste imposé.
function applyDelta(dx, dy) {
curWidth = Math.max(8, Math.min(SCENE_WIDTH - left, curWidth + dx));
curHeight = Math.max(8, Math.min(SCENE_HEIGHT - top, curHeight + dy));
curWidth = Math.max(8, curWidth + dx);
curHeight = Math.max(8, curHeight + dy);
el.style.width = curWidth + 'px';
el.style.height = curHeight + 'px';
}